Announcement Announcement Module
Collapse
No announcement yet.
JPOX, HSQLDB and Spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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"/>

    Comment


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

      Comment

      Working...
      X