IBM Support

PM93312: MERGE OF LAZILY FETCHED FIELDS, AND MERGE OF MANAGED ENTITIES DEVIATES FROM THE JPA 2.0 SPECIFICATION.

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • After using JPA merge on a managed entity, it appears that
    fields, that have not been fetched in the current transaction,
    get broken. An attempt to get field, that was initially
    assigned some value (in another transaction), doesn't return
    expected object, although entity is managed.
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All users of IBM WebSphere Application      *
    *                  Server V8.0.                                *
    ****************************************************************
    * PROBLEM DESCRIPTION: Merge of lazily fetched fields, and     *
    *                      merge of managed entities deviates      *
    *                      from the JPA 2.0 Specification.         *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    The JPA 2.0 Specification, Section 3.2.7.1 (Merging
    Detached Entity State) states the following:
    "If X is a managed entity, it is ignored by the merge
    operation, however, the merge operation is
    cascaded to entities referenced by relationships from X if
    these relationships have been annotated
    with the cascade element value cascade=MERGE or cascade=ALL
    annotation."
    Further in the same section it states:
    "The persistence provider must not merge fields marked LAZY
    that have not been fetched: it must ignore such fields when
    merging.".
    Take the following example entity:
    @Entity
    public class Employee {
    @Id
    private Long id;
    @ManyToOne
    private Employee supervisor;
    @OneToMany(mappedBy="supervisor",
    cascade={javax.persistence.CascadeType.ALL})
    private List<Employee> subordinates;
    Take the following example usage of this entity:
    //assume there exists an Employee in the database, with
    //'subordinates'.
    Employee result =
    (Employee)this.entityManager.find(Employee.class, id);
    result = (Employee)this.entityManager.merge(result);
    result.getSubordinates();  //will return empty list
    The 'subordinates' in this case will not be returned.  However,
    per the spec the subordinates should be returned after the
    merge.
    

Problem conclusion

  • With this fix, code has been added to OpenJPA to ensure fields
    are properly cascaded after a managed entity is merged.
    
    The fix for this APAR is currently targeted for
    inclusion in Service Level (Fix Pack) 8.0.0.8 of WebSphere
    Application Server version 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

    PM93312

  • Reported component name

    WEBSPHERE APP S

  • Reported component ID

    5724J0800

  • Reported release

    800

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2013-07-18

  • Closed date

    2013-07-23

  • Last modified date

    2013-11-26

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

    PM87297

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

Fix information

  • Fixed component name

    WEBSPHERE APP S

  • Fixed component ID

    5724J0800

Applicable component levels

  • 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":"8.0","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
01 November 2021