IBM Support

PH36843: ECLIPSELINK THROWS EXCEPTION FOR CRITERIABUILDER QUERIES WITH ONLY LITERAL VALUES

Subscribe to this APAR

By subscribing, you receive periodic emails alerting you to the status of the APAR, along with a link to the fix after it becomes available. You can track this item individually or track all items by product.

Notify me when this APAR changes.

Notify me when an APAR for this component changes.

 

APAR status

  • Closed as program error.

Error description

  • EclipseLink throws an exception for CriteriaBuilder queries
    that contain only literal values in WHERE clause
    and/or literal values in the SELECT clause. However, JPQL
    queries that also only contain literal values or parameters do
    not throw an exception.
    
    Exception example:
    ´´´
    org.eclipse.persistence.exceptions.QueryException
    Exception Description: A reference class must be provided.
    Query: ReportQuery()
     at
    org.eclipse.persistence.exceptions.QueryException.referenceClass
    Missing(QueryException.java:1064)
     at
    org.eclipse.persistence.queries.ObjectLevelReadQuery.checkDescri
    ptor(ObjectLevelReadQuery.java:835)
     at
    org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQu
    ery.java:828)
     at
    org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(Obj
    ectLevelReadQuery.java:1142)
     at
    org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuer
    y.java:460)
     at
    org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUn
    itOfWork(ObjectLevelReadQuery.java:1230)
     at
    org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.interna
    lExecuteQuery(UnitOfWorkImpl.java:2900)
     at
    org.eclipse.persistence.internal.sessions.AbstractSession.execut
    eQuery(AbstractSession.java:1866)
     at
    org.eclipse.persistence.internal.sessions.AbstractSession.execut
    eQuery(AbstractSession.java:1848)
     at
    org.eclipse.persistence.internal.sessions.AbstractSession.execut
    eQuery(AbstractSession.java:1813)
     at
    org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(
    QueryImpl.java:258)
     at
    org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(Que
    ryImpl.java:473)
    ´´´
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All users of IBM WebSphere Application      *
    *                  Server - Java Persistence API - JPA 2.1 &   *
    *                  EclipseLink                                 *
    ****************************************************************
    * PROBLEM DESCRIPTION: EclipseLink throws an exception for     *
    *                      CriteriaBuilder queries with only       *
    *                      literal values in WHERE clause or       *
    *                      SELECT clause                           *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    Example:
    ´´´
    CriteriaBuilder cb = em.getCriteriaBuilder( );
    CriteriaQuery< Object[ ] > cq = cb.createQuery( Object[
    ].class );
    Root< Country > r = cq.from( Country.class );
    cq.multiselect( cb.literal( "1" ), r.get( "name" ) );
    em.createQuery( cq ).getResultList( );
    &#180;&#180;&#180;
    Exception:
    &#180;&#180;&#180;
    org.eclipse.persistence.exceptions.QueryException
    Exception Description: A reference class must be provided.
    Query: ReportQuery()
    at
    org.eclipse.persistence.exceptions.QueryException.referenceClass
    Missing(QueryException.java:1064)
    at
    org.eclipse.persistence.queries.ObjectLevelReadQuery.checkDescri
    ptor(ObjectLevelReadQuery.java:827)
    at
    org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQu
    ery.java:824)
    &#180;&#180;&#180;
    

Problem conclusion

Temporary fix

Comments

APAR Information

  • APAR number

    PH36843

  • Reported component name

    WEBSPHERE APP S

  • Reported component ID

    5724J0800

  • Reported release

    900

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2021-04-29

  • Closed date

    2021-07-07

  • Last modified date

    2021-07-07

  • 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

  • R900 PSY

       UP

[{"Line of Business":{"code":"LOB36","label":"IBM Automation"},"Business Unit":{"code":"BU053","label":"Cloud \u0026 Data Platform"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"900"}]

Document Information

Modified date:
16 July 2021