IBM Support

PI37124: WRONG QUERY IS GENERATED WHEN USING JPA 2.2 WITH CRITERIA BUILDER AND SUB QUERY

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • In WebSphere Application Server v8.5.5 and v8.0 when using
    JPA 2.2 with criteria builder and sub query, the wrong query
    is generated.
    

Local fix

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 CriteriaBuilder and sub        *
    *                  selects.                                    *
    ****************************************************************
    * PROBLEM DESCRIPTION: A column is aliased twice in a          *
    *                      subquery when the query is generated    *
    *                      with CriteriaBuilder.                   *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    There is a scenario where an extra alias is generated for a
    query created by CriteriaBuilder. For the given scenario, a
    CriteriaBuild is created such that the resultant JPQL string
    when printed is as follows:
    SELECT f.employeeCount FROM DimDay d, FactWorkAssignment f
    WHERE (f.orgOID = 'dummy1' AND d.roll13MonthInd = 1 AND
    f.personObjId IN (SELECT f.personObjId FROM FactWorkAssignment
    f WHERE (f.orgOID = 'dummy1' AND d.monthStrtDate = 20150201)).
    When the CriteriaBuilder is used to run this query string,
    this SQL is generated:
    SELECT t0.empl_cnt FROM
    T_FACT_WORK_ASGNMT t0, T_DIM_DAY t1, T_DIM_DAY t3
    WHERE (t0.CLNT_OBJ_ID = ? AND t1.ROLL_13_MNTH_IND = ? AND
    t0.pers_obj_id IN (
    SELECT t2.pers_obj_id FROM T_FACT_WORK_ASGNMT t2 WHERE
    (t2.CLNT_OBJ_ID = ? AND t3.MNTH_STRT_DAY_KY >= ?)))
    Notice that T_DIM_DAY is aliased twice.
    If the above JPQL string is used to create or run a query, the
    generated query is exactly like the above SQL, minus the
    'T_DIM_DAY t3'.  As can be seen, there is a different path
    when creating or running a query with a CriteriaBuilder as
    opposed to just a JPQL string.
    

Problem conclusion

  • With this fix, code has been added to OpenJPA to remove the
    duplicate alias.
    
    The fix for this APAR is currently targeted for
    inclusion in Service Levels 8.0.0.11 and 8.5.5.6 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

    PI37124

  • Reported component name

    WEBSPHERE APP S

  • Reported component ID

    5724J0800

  • Reported release

    800

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2015-03-16

  • Closed date

    2015-05-18

  • Last modified date

    2015-05-18

  • 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

    WEBSPHERE APP S

  • Fixed component ID

    5724J0800

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