IBM Support

PI35453: OPENJPA TRANSFORMS JPQL TO SQL INCORRECTLY

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • changing from TypedQuery to Query
    
    TypedQuery q = em2.createQuery(jpql, CashFlowPlanPO.class);
    
    Change it to this and all will work well:
    
    Query q = em2.createQuery(jpql);
    

Local fix

  • N/A
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All users of IBM WebSphere Application      *
    *                  Server V8.0.0, V8.5.0, and V8.5.5           *
    *                  who make use of a JPA 'inner join'.         *
    ****************************************************************
    * PROBLEM DESCRIPTION: OpenJPA occasionally generates an       *
    *                      incorrect 'inner join' SQL statement.   *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    Take the following JPQL statement:
    SELECT B FROM EntityA A, EntityB B
    WHERE A.time IS NULL and A.status = :app and A.someId in (:ids)
    and B.time IS NULL and B.status = :app2 and A.id = B.id
    ORDER BY B.id
    Occasionally this JPQL will be translated by OpenJPA to the
    following unexpected SQL:
    SELECT t1.ID, t1.SOME_ID
    FROM EntityB t0 JOIN EntityB t1 ON (1 = 1)
    WHERE (t0.TIME IS NULL AND t0.STATUS = ? AND t0.SOME_ID IN
    AND t1.TIME IS NULL AND t1.STATUS = ? AND t1.ID = t0.ID)
    ORDER BY t1.SOME_ID ASC
    Notice in the generated SQL the entry "EntityB t0 JOIN EntityB
    t1".  This should be "EntityA t0 JOIN EntityB t1".  In other
    words, EntityB is aliased twice.  In most cases the correct
    SQL is generated but sporadically the incorrect SQL is
    generated.  This issue is due to a race condition in the
    OpenJPA code during the processing of the join statement.
    

Problem conclusion

  • With this fix, code has been added to OpenJPA to properly
    synchronize code which processes the JPQL join statements in
    order to avoid the race condition which can cause a duplicate
    table alias.
    
    The fix for this APAR is currently targeted for
    inclusion in Service Levels (Fix Packs) 8.0.0.12 and
    8.5.5.8 of WebSphere Application Server versions 8.0.0 and
    8.5.5.
    
    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

    PI35453

  • Reported component name

    WEBS APP SERV N

  • Reported component ID

    5724H8800

  • Reported release

    800

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2015-02-19

  • Closed date

    2015-06-25

  • Last modified date

    2015-06-25

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

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

Fix information

  • Fixed component name

    WEBS APP SERV N

  • Fixed component ID

    5724H8800

Applicable component levels

  • R800 PSY

       UP

  • R850 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:
28 April 2022