IBM Support

PM87616: PERSISTING AN OBJECT STRUCTURE WITH AN INHERITANCE RELATIONSHIP WITH THE JPA 2.0 FEATUREPACK CAUSES A CONSTRAINT VIOLATION

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • When inserting ObjectA in to a database with ObjectB attached
    to it, ObjectA is inserted twice resulting in a sqlstate 23505
    constraint violation.
    
    The Primary Key of ObjectC is autogenerated and is used in
    ObjectA as the Primary Key.  It is also used as part of
    ObjectB's Primary Key.
    
    In testing, if you use the same setup while replacing the
    combined Primary Key of ObjectB with a single Primary Key, the
    test case runs without errors.
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All users of the Java Persistence API       *
    *                  (JPA) 2.0 feature of the IBM WebSphere      *
    *                  Application Server V7 Feature Pack for      *
    *                  OSGi Applications and Java Persistence API  *
    *                  2.0 who make use MapsID and auto-generated  *
    *                  identity.                                   *
    ****************************************************************
    * PROBLEM DESCRIPTION: MapsId in a Child entity to a Parent    *
    *                      entity using auto-assigned identity     *
    *                      fails with duplicte INSERT SQL.         *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    A MapsId annotation in entity C (child) annotates a field p of
    type P (parent). P uses auto-generated identity.
    P-C is a bidirectional parent-child relationship.
    During flush sequence, a row is created for P and flushed for
    the database to assign an identity. When C is flushed, it
    wrongly creates a row for P again while handling the field p
    that points to parent.
    This results in a commit which fails with a
    DuplicateKeyException on P's table.
    

Problem conclusion

  • With this fix, code has been added to OpenJPA to properly
    generate SQL when handling a Parent/Child relationship
    which uses MapsID and auto-generated identity.
    
    The fix for this APAR is currently targeted for inclusion
    in Fix Pack 1.0.0.11 for the Feature Pack for OSGi Applications
    and Java Persistence API 2.0.
    
    Please refer to the recommended updates page for delivery
    information:
    http://www.ibm.com/support/docview.wss?rs=180&uid=swg27004980
    
    Please refer to URL:
    //www.ibm.com/support/docview.wss?rs=404&uid=swg27006970
    for Fix Pack availability.
    

Temporary fix

Comments

APAR Information

  • APAR number

    PM87616

  • Reported component name

    WEBSPHERE FOR Z

  • Reported component ID

    5655I3500

  • Reported release

    700

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2013-04-23

  • Closed date

    2013-07-09

  • Last modified date

    2013-07-17

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

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

    PM87952 PM89305

Fix information

  • Fixed component name

    JPA OSGI FEATUR

  • Fixed component ID

    5655N0257

Applicable component levels

  • R700 PSY

       UP

[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SG19M","label":"APARs - z\/OS environment"},"Platform":[{"code":"PF054","label":"z Systems"}],"Version":"1.0","Line of Business":{"code":"","label":""}}]

Document Information

Modified date:
14 December 2020