IBM Support

PM86718: Enhancer generates invalid code if fetch-groups is activated.

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • After apply iFix  PM78711 ,    a problem with   When set this
    OpenJPA property
    
    <property name="openjpa.DetachState" value="fetch-groups
    (DetachedStateField=true)"/>
    
    OpenJPA implements java.io.Externalizable for every entity. The
    
    Externalizable interface requires two methods:
    writeExternal(..) and
    readExternal(..). Both methods are implemented in a wrong way
    when a class extends a superclass.
    
       Exception in thread "main" java.lang.IllegalAccessError
       at de.continentale.muv.genexternalizable.model.SimpleEntity.
    
       writeExternal(SimpleEntity.java)
       at
    java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.
    
       java:1449)
       ...
    

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 of OpenJPA fetch-groups.   *
    ****************************************************************
    * PROBLEM DESCRIPTION: Enhancer generates invalid code if      *
    *                      fetch-groups is activated.              *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    If openjpa.DetachState=fetch-groups is used, the
    OpenJPA enhancer will add a 'implements Externalizable' to the
    class, and add a 'writeExternal' and 'readExternal' method.
    The problem is that 'writeExternal' and 'readExternal' will
    also try to externalize the private members of any given
    superclass.  This will cause a runtime exception indicating
    the private members are not accessible, as follows:
    Exception in thread "main" java.lang.IllegalAccessError
    at com.ibm.xxx.yyy.MyEntity.writeExternal(MyEntity.java)
    at java.io.ObjectOutputStream.
    writeExternalData(ObjectOutputStream.java:1449)
    As an example, take the following code snippets:
    @Entity
    public abstract class AbstractGroup {
    ...
    @Temporal(TemporalType.TIMESTAMP)
    private Date applicationBegin;
    ...
    }
    and
    @Entity
    public class Group extends AbstractGroup {
    ...
    }
    This will result in the following generate code which shows
    that private member 'applicationBegin' is accessed:
    public void writeExternal(ObjectOutput objectoutput)
    throws IOException
    {
    pcWriteUnmanaged(objectoutput);
    if(pcStateManager != null)
    {
    if(pcStateManager.writeDetached(objectoutput))
    return;
    } else
    {
    objectoutput.writeObject(pcGetDetachedState());
    objectoutput.writeObject(null);
    }
    objectoutput.writeObject(applicationBegin);
    ...
    

Problem conclusion

  • With this fix, code has been added to OpenJPA to generate
    proper code when openjpa.DetachState=fetch-groups is used.
    
    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
    

Temporary fix

Comments

APAR Information

  • APAR number

    PM86718

  • Reported component name

    WEBS APP SERV N

  • Reported component ID

    5724H8800

  • Reported release

    700

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2013-04-10

  • Closed date

    2013-07-12

  • Last modified date

    2013-07-12

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

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

    PM89276

Fix information

  • Fixed component name

    JPA OSGI FEATUR

  • Fixed component ID

    5724J0857

Applicable component levels

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

Document Information

Modified date:
29 September 2020