Error generating PK for entity 'DbEntity:

From: Mike Kienenberger (mkienen..laska.net)
Date: Thu Oct 23 2003 - 19:16:08 EDT

  • Next message: Steve Steinitz: "Re: runtime error - can't find generated class"

    I started to see some odd PK generation errors while doing testing of my
    struts app today:

    The root cause appears to be:

    Caused by: java.sql.SQLException: ERROR - Value can not be NULL for column
    'NEXT_ID'
    SQL: UPDATE AUTO_PK_SUPPORT SET NEXT_ID = NEXT_ID + 20 WHERE TABLE_NAME =
    'LOG'
            at com.openbase.jdbc.s.executeUpdate(Unknown Source)
            at org.objectstyle.cayenne.access.DataNode.runUpdate(DataNode.java:435)

    The error doesn't happen every time I run the application, but approximately
    every other time.

    I'm getting it while trying to debug some other checkbox submit problem on a
    complicated multistep "apply-for-userid wizard", but I can't think of
    anything that'd cause the problem right off.

    I started using OpenBase with the generic JDBC adaptor, and I haven't done
    much testing since switching to this development database, so I suppose that
    could be part of the issue.

    The AUTO_PK_SUPPORT table contains NEXT_ID = 32020 currently.

    -Mike

    org.objectstyle.cayenne.CayenneRuntimeException: [v.1.1-dev-2003-9-25
    September 25 2003] org.objectstyle.cayenne.CayenneException:
    [v.1.1-dev-2003-9-25 September 25 2003] Error generating PK:
    [v.1.1-dev-2003-9-25 September 25 2003] Error generating PK.
            at
    org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.java:773)
            at
    org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.java:743)
    [...]
            at
    org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
            at java.lang.Thread.run(Thread.java:534)
    Caused by: org.objectstyle.cayenne.CayenneException: [v.1.1-dev-2003-9-25
    September 25 2003] Error generating PK: [v.1.1-dev-2003-9-25 September 25
    2003] Error generating PK.
            at
    org.objectstyle.cayenne.access.util.PrimaryKeyHelper.createPermIdsForObjEntity(PrimaryKeyHelper.java:202)
            at
    org.objectstyle.cayenne.access.ContextCommit.createPrimaryKeys(ContextCommit.java:482)
            at
    org.objectstyle.cayenne.access.ContextCommit.commit(ContextCommit.java:140)
            at
    org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.java:769)
            ... 37 more
    Caused by: org.objectstyle.cayenne.CayenneRuntimeException:
    [v.1.1-dev-2003-9-25 September 25 2003] Error generating PK.
            at
    org.objectstyle.cayenne.dba.JdbcPkGenerator$PkRetrieveProcessor.nextGlobalException(JdbcPkGenerator.java:471)
            at
    org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:355)
            at
    org.objectstyle.cayenne.dba.JdbcPkGenerator.pkFromDatabase(JdbcPkGenerator.java:358)
            at
    org.objectstyle.cayenne.dba.JdbcPkGenerator.generatePkForDbEntity(JdbcPkGenerator.java:309)
            at
    org.objectstyle.cayenne.access.util.PrimaryKeyHelper.createPermIdsForObjEntity(PrimaryKeyHelper.java:197)
            ... 40 more
    Caused by: org.objectstyle.cayenne.CayenneRuntimeException:
    [v.1.1-dev-2003-9-25 September 25 2003] Error generating PK for entity
    'DbEntity:
    Table name: LOG
       Column name: ADMINISTRATIVE_USER_ID
       Column type: 4
    ------------------
       Column name: FIELD_NAME
       Column type: 12
    ------------------
       Column name: FOREIGN_RECORD_KEY
       Column type: 4
    ------------------
       Column name: LOG_ID (pk)
       Column type: 4
    ------------------
       Column name: MODIFICATION_DATE
       Column type: 91
    ------------------
       Column name: NEW_VALUE
       Column type: 12
    ------------------
       Column name: OLD_VALUE
       Column type: 12
    ------------------
       Column name: TABLE_NAME
       Column type: 12
    ------------------
       Column name: USER_ID
       Column type: 4
    ------------------
       Rel. to: USER_TABLE
    ------------------
       Rel. to: ACH_PROCESSING_QUEUE
    ------------------
       Rel. to: ACCOUNT
    ------------------
       Rel. to: ACCOUNT_ACTIVATION
    ------------------
       Rel. to: APPLICATION_DATA
    ------------------
       Rel. to: BANK
    ------------------
       Rel. to: BANK_ACCOUNT
    ------------------
       Rel. to: COMMENTS
    ------------------
       Rel. to: CREDIT_CARD
    ------------------
       Rel. to: DATA_DICTIONARY
    ------------------
       Rel. to: HELP_TOPICS
    ------------------
       Rel. to: JUST_BILLED_ACCOUNT
    ------------------
       Rel. to: LOCALIZATION
    ------------------
       Rel. to: PAPER_BILL_WARNING
    ------------------
       Rel. to: PAYMENT_HISTORY
    ------------------
       Rel. to: PAYMENT_IN_PROCESS
    ------------------
       Rel. to: PAYMENT_METHOD
    ------------------
       Rel. to: PENDING_PAYMENT
    ------------------
       Rel. to: PROCESSING_RESULT_ACTION
    ------------------
       Rel. to: SCHEDULED_PAYMENT
    ------------------
       Rel. to: SEND_PAPER_BILL_CHANGES
    ------------------
       Rel. to: STATES
    ------------------
       Rel. to: USER_TABLE
    ------------------
       Rel. to: USER_ACCOUNT_RELATIONSHIP
    ------------------
       Rel. to: USER_TABLE
    ------------------'.
            at
    org.objectstyle.cayenne.dba.JdbcPkGenerator$PkRetrieveProcessor.nextQueryException(JdbcPkGenerator.java:464)
            at
    org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:309)
            ... 43 more
    Caused by: java.sql.SQLException: ERROR - Value can not be NULL for column
    'NEXT_ID'
    SQL: UPDATE AUTO_PK_SUPPORT SET NEXT_ID = NEXT_ID + 20 WHERE TABLE_NAME =
    'LOG'
            at com.openbase.net.c.a(Unknown Source)
            at com.openbase.jdbc.p.a(Unknown Source)
            at com.openbase.jdbc.p.do(Unknown Source)
            at com.openbase.jdbc.s.executeUpdate(Unknown Source)
            at org.objectstyle.cayenne.access.DataNode.runUpdate(DataNode.java:435)
            at
    org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:299)
            ... 43 more



    This archive was generated by hypermail 2.0.0 : Thu Oct 23 2003 - 19:15:13 EDT