IBM Support

PM93342: 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 IBM WebSphere Application      *
    *                  Server Liberty Profile                      *
    ****************************************************************
    * 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 8.5.5.1. 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

    PM93342

  • Reported component name

    LIBERTY PROFILE

  • Reported component ID

    5724J0814

  • Reported release

    850

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2013-07-18

  • Closed date

    2013-09-13

  • Last modified date

    2013-09-13

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

    PM89305

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

Fix information

  • Fixed component name

    LIBERTY PROFILE

  • Fixed component ID

    5724J0814

Applicable component levels

  • R850 PSY

       UP

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"850","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
13 September 2013