Results 1 to 3 of 3

Thread: JPOX, HSQLDB and Spring

Hybrid View

  1. #1
    Join Date
    Aug 2004
    Location
    Denver
    Posts
    249

    Default JPOX, HSQLDB and Spring

    I'm seeing a wierd combination of things in Equinox when using HSQLDB, JPOX and Spring:

    First of all, my JDBC URL for my HSQLDB database is set at:

    jdbc.url=jdbc:hsqldb:db/equinox

    I'm using HSQLDB version 1.7.1 because I've found when I upgrade to 1.7.3, my jWebUnit tests quit working (because of a file lock error).

    JPOX 1.1.0-beta-1 + Spring 1.1.3 + HSQLDB 1.7.1 = works fine
    JPOX 1.1.0-beta-1 + Spring 1.1.4 + HSQLDB 1.7.1 = results in the following error:

    Code:
        [junit] (JDO operation): data integrity violated by SQL ''; nested exception
     is java.sql.SQLException: Try to insert null into a non-nullable column in statement [INSERT INTO APP_USER (FIRST_NAME,LAST_NAME,BIRTHDAY,ID) VALUES ('Rod','Johnson',NULL,NULL)]
    JPOX 1.1.0-beta-1 + Spring 1.1.4 + HSQLDB 1.7.3 = results in the following error:

    Code:
        [junit] NestedThrowables:
        [junit] java.sql.SQLException: The database is already in use by another pro
    cess: org.hsqldb.NIOLockFile@76a8caef[file =C:\Source\equinox\extras\jdo\db\equinox.lck, exists=true, locked=false, valid=false, fl =null]: java.lang.Exception:
     The process cannot access the file because another process has locked a portion
     of the file : C:\Source\equinox\extras\jdo\db\equinox.lck
    So it seems there's an issue with HSQLDB 1.7.1 and Spring 1.1.4. Everything works fine with 1.1.3. For good meaure, I tried a spring.jar built from CVS and I got the same error. Strangely enough, this seems to only be an issue with JPOX - all other persistence packages (Hibernate, Spring JDBC, iBATIS and OJB) work fine with HSQLDB 1.7.1 and Spring 1.1.4.

    My package.jdo file looks as follows:

    Code:
    <?xml version="1.0"?>
    <!DOCTYPE jdo PUBLIC 
        "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 2.0//EN" 
        "http&#58;//java.sun.com/dtd/jdo_2_0.dtd">
    <jdo>
        <package name="org.appfuse.model">
            <class name="User" identity-type="application"
                   objectid-class="org.appfuse.model.PrimaryKey"
                   table="app_user">
                <field name="id" primary-key="true"/>
                <field name="firstName" persistence-modifier="persistent">
                    <column name="first_name" jdbc-type="VARCHAR" length="50"/>
                </field>
                <field name="lastName" persistence-modifier="persistent">
                    <column name="last_name" jdbc-type="VARCHAR" length="50"/>
                </field>
                <field name="birthday"/>
                <extension vendor-name="jpox" key="use-poid-generator" value="true"/>
            </class>
        </package>
    </jdo>
    For now, I guess I'll just stick with Spring 1.1.3 with JPOX and HSQLDB 1.7.1. A better solution would probably be to figure out the lock problem with 1.7.3 or use some other in-memory database.

  2. #2

    Default Re: JPOX, HSQLDB and Spring

    Code:
        &#91;junit&#93; &#40;JDO operation&#41;&#58; data integrity violated by SQL ''; nested exception
     is java.sql.SQLException&#58; Try to insert null into a non-nullable column in statement &#91;INSERT INTO APP_USER &#40;FIRST_NAME,LAST_NAME,BIRTHDAY,ID&#41; VALUES &#40;'Rod','Johnson',NULL,NULL&#41;&#93;
    Code:
    <field name="birthday"/>
    Hi Matt,
    Are you starting from an empty schema ? or are you using existing tables ? If it is the latter, do the birthday and id columns support nulls ?
    In JDO2 you can define this explicitly in your JDO MetaData by changing it to
    Code:
    <field name="birthday" allows-null="true"/>
    -Andy
    DataNucleus - Standardised persistence, multiple datastores

  3. #3
    Join Date
    Aug 2004
    Location
    Denver
    Posts
    249

    Default

    Thanks Andy - this is what I ended up doing and it solved the problem.

Similar Threads

  1. HSQLDB datasource is not correctly shutdown
    By sebastien in forum Data
    Replies: 1
    Last Post: Sep 27th, 2010, 08:53 AM
  2. HSQL server wrapped into a Spring bean
    By sebastien in forum Data
    Replies: 9
    Last Post: Dec 1st, 2009, 10:32 AM
  3. Junit testing with Ant & HSQLDB in memory
    By teneighty in forum Architecture
    Replies: 6
    Last Post: Jan 1st, 2009, 04:10 PM
  4. Replies: 1
    Last Post: Dec 7th, 2004, 03:10 PM
  5. Spring Framework 1.1.2 Released
    By Colin Sampaleanu in forum Announcements
    Replies: 0
    Last Post: Nov 14th, 2004, 06:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •