IBM Support

PM40051: "CANNOT INSERT NULL INTO" PRIMARY KEY FIELD WHEN ADDING 2 JPA ENTITIES.

Fixes are available

7.0.0.21: WebSphere Application Server V7.0 Fix Pack 21
8.0.0.2: WebSphere Application Server V8.0 Fix Pack 2
8.0.0.3: WebSphere Application Server V8.0 Fix Pack 3
7.0.0.23: WebSphere Application Server V7.0 Fix Pack 23
8.0.0.4: WebSphere Application Server V8.0 Fix Pack 4
7.0.0.25: WebSphere Application Server V7.0 Fix Pack 25
8.0.0.5: WebSphere Application Server V8.0 Fix Pack 5
7.0.0.27: WebSphere Application Server V7.0 Fix Pack 27
8.0.0.6: WebSphere Application Server V8.0 Fix Pack 6
7.0.0.29: WebSphere Application Server V7.0 Fix Pack 29
8.0.0.7: WebSphere Application Server V8.0 Fix Pack 7
8.0.0.8: WebSphere Application Server V8.0 Fix Pack 8
7.0.0.31: WebSphere Application Server V7.0 Fix Pack 31
7.0.0.27: Java SDK 1.6 SR13 FP2 Cumulative Fix for WebSphere Application Server
7.0.0.33: WebSphere Application Server V7.0 Fix Pack 33
8.0.0.9: WebSphere Application Server V8.0 Fix Pack 9
7.0.0.35: WebSphere Application Server V7.0 Fix Pack 35
8.0.0.10: WebSphere Application Server V8.0 Fix Pack 10
7.0.0.37: WebSphere Application Server V7.0 Fix Pack 37
8.0.0.11: WebSphere Application Server V8.0 Fix Pack 11
7.0.0.39: WebSphere Application Server V7.0 Fix Pack 39
8.0.0.12: WebSphere Application Server V8.0 Fix Pack 12
7.0.0.41: WebSphere Application Server V7.0 Fix Pack 41
8.0.0.13: WebSphere Application Server V8.0 Fix Pack 13
7.0.0.43: WebSphere Application Server V7.0 Fix Pack 43
8.0.0.14: WebSphere Application Server V8.0 Fix Pack 14
7.0.0.45: WebSphere Application Server V7.0 Fix Pack 45
8.0.0.15: WebSphere Application Server V8.0 Fix Pack 15
7.0.0.21: Java SDK 1.6 SR9 FP2 Cumulative Fix for WebSphere
7.0.0.23: Java SDK 1.6 SR10 FP1 Cumulative Fix for WebSphere
7.0.0.25: Java SDK 1.6 SR11 Cumulative Fix for WebSphere Application Server
7.0.0.27: Java SDK 1.6 SR12 Cumulative Fix for WebSphere Application Server
7.0.0.29: Java SDK 1.6 SR13 FP2 Cumulative Fix for WebSphere Application Server
7.0.0.45: Java SDK 1.6 SR16 FP60 Cumulative Fix for WebSphere Application Server
7.0.0.31: Java SDK 1.6 SR15 Cumulative Fix for WebSphere Application Server
7.0.0.35: Java SDK 1.6 SR16 FP1 Cumulative Fix for WebSphere Application Server
7.0.0.37: Java SDK 1.6 SR16 FP3 Cumulative Fix for WebSphere Application Server
7.0.0.39: Java SDK 1.6 SR16 FP7 Cumulative Fix for WebSphere Application Server
7.0.0.41: Java SDK 1.6 SR16 FP20 Cumulative Fix for WebSphere Application Server
7.0.0.43: Java SDK 1.6 SR16 FP41 Cumulative Fix for WebSphere Application Server

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The following exception occurs when inserting multiple
    entities where the entites contain sequence generated id and
    contain relationships with other entities:
    
    Caused by: <openjpa-1.1.0-r422266:657916 nonfatal general
    error> org.apache.openjpa.persistence.PersistenceException:
    ORA-01400: cannot insert NULL into
    ("MYSCHEMA"."MYENTITY"."MYENTITY_ID")
    FailedObject: prepstmnt 674113582 INSERT INTO
    MYSCHEMA.MYENTITY (MYENTITY_ID, MYENTITY_TEXT,
    ANOTHER_ENTITY_ID)
    VALUES (?, ?, ?)
    [org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedS
    tatement]
    at
    org.apache.openjpa.jdbc.sql.SQLExceptions.narrow(SQLExceptions.j
    ava:144)
    at
    org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDic
    tionary.java:4150)
    at
    org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions
    .java:102)
    at
    org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions
    .java:72)
    at
    org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerI
    mpl.flushBatch(BatchingPreparedStatementManagerImpl.java:183)
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All users of IBM WebSphere Application      *
    *                  Server V7.0.0 and V8.0.0 who use sequence   *
    *                  generated ids and bi-directional            *
    *                  relationships in their Java Persistence     *
    *                  API (JPA) entities.                         *
    ****************************************************************
    * PROBLEM DESCRIPTION: Sequence generated ids may fail to      *
    *                      get assigned when flushing a graph      *
    *                      with bi-directional relationships.      *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    Flushing a multi-level graph with many bi-directional
    relationships can result in SQL exceptions due to
    sequence-generated IDs of some leaf entities not getting
    assigned during pre-flush. Sequence-generated id's require an
    additional ID population step which happens during pre-flush.
    OpenJPA's state transitioning during a pre-flush can fail to
    pre-flush child entities when certain bi-directional
    traversals occur.
    

Problem conclusion

  • With this fix, code has been added such that when flushing,
    a pre-flush will occur on entities that may have moved from
    provisional to new state (as a result of a previous traversal)
    without being properly pre-flushed. If the entity was
    previously pre-flushed, it will have been tagged as such and
    the operation will simply return. Otherwise, it will pre-flush
    the entity and all child entities, generating IDs in the
    process.
    
    The fix for this APAR is currently targeted for
    inclusion in Service Levels (Fix Packs) 7.0.0.21 and 8.0.0.2
    of WebSphere Application Server versions 7.0.0 and 8.0.0.
    
    Please refer to the recommended updates page for delivery
    information:
    http://www.ibm.com/support/docview.wss?rs=180&uid=swg27004980
    

Temporary fix

Comments

APAR Information

  • APAR number

    PM40051

  • Reported component name

    WEBSPHERE APP S

  • Reported component ID

    5724J0800

  • Reported release

    700

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2011-05-25

  • Closed date

    2011-08-25

  • Last modified date

    2011-09-02

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

    PM42704

Fix information

  • Fixed component name

    WEBSPHERE APP S

  • Fixed component ID

    5724J0800

Applicable component levels

  • R700 PSY

       UP

  • R800 PSY

       UP

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7.0","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
27 October 2021