IBM Support

PI13616: OPENJPA-2286 ARGUMENTEXCEPTION: ATTEMPT TO COMPARE INCOMPATIBLE TYPES.

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • In an attempt to use date literals for data range in JPQL,
    the following error occurs:
    
    Caused by: <openjpa-2.2.1.1-SNAPSHOT-r422266:1438134 nonfatal
    user
    error> org.apache.openjpa.persistence.ArgumentException:
    Attempt to
    compare incompatible types "class java.util.Date" and "class
    org.apache.
    openjpa.jdbc.sql.Raw".
    at
    org.apache.openjpa.jdbc.kernel.exps.CompareExpression.appendTo
    (CompareExpression.java:72)
    at org.apache.openjpa.jdbc.kernel.exps.AndExpression.appendTo
    (AndExpression.java:59)
    at org.apache.openjpa.jdbc.kernel.exps.AndExpression.appendTo
    (AndExpression.java:59)
    at
    org.apache.openjpa.jdbc.kernel.exps.BindVariableAndExpression.
    appendTo(BindVariableAndExpression.java:57)
    at
    org.apache.openjpa.jdbc.kernel.exps.SelectConstructor.buildWhere
    (SelectConstructor.java:312)
    at
    org.apache.openjpa.jdbc.kernel.exps.SelectConstructor.evaluate
    (SelectConstructor.java:94)
    at
    org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.createWhereSelects
    (JDBCStoreQuery.java:360)
    at org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.executeQuery
    (JDBCStoreQuery.java:193)
    at
    org.apache.openjpa.kernel.ExpressionStoreQuery$DataStoreExecutor
    .
    executeQuery(????????????????)
    at
    org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1005)
    at
    org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:863)
    at
    org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:794)
    at
    org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuer
    y.
    java:542)
    at
    org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:
    286)
    at
    org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl
    .
    java:302)
    at
    com.ibm.ws.persistence.QueryImpl.getResultList(QueryImpl.java:11
    8)
    

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 query which contains a         *
    *                  Date/Timestamp literal.                     *
    ****************************************************************
    * PROBLEM DESCRIPTION: ArgumentException: Attempt to compare   *
    *                      incompatible types class                *
    *                      java.util.Date and class                *
    *                      org.apache.openjpa.jdbc.sql.Raw         *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    Take the following JPA queries:
    Query q = em.createQuery("SELECT e FROM Employee e
    WHERE e.hireTimestamp > {ts '2001-01-01 00:00:00'}");
    q.getResultList();
    q.getResultList();
    The first run of the query (i.e. q.getResultList()) will
    work as expected.  The second run will result in the
    following exception:
    org.apache.openjpa.persistence.ArgumentException: Attempt to
    compare incompatible types "class java.util.Date" and "class
    org.apache.openjpa.jdbc.sql.Raw".
    at
    org.apache.openjpa.jdbc.kernel.exps.CompareEqualExpression.appen
    dTo(CompareEqualExpression.java:101)
    at
    org.apache.openjpa.jdbc.kernel.exps.AndExpression.appendTo(AndEx
    pression.java:65)
    at
    org.apache.openjpa.jdbc.kernel.exps.SelectConstructor.buildWhere
    (SelectConstructor.java:312)
    at
    org.apache.openjpa.jdbc.kernel.exps.SelectConstructor.evaluate(S
    electConstructor.java:94)
    at
    org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.createWhereSelects
    (JDBCStoreQuery.java:360)
    at
    org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.executeQuery(JDBCS
    toreQuery.java:193)
    at
    org.apache.openjpa.kernel.ExpressionStoreQuery$DataStoreExecutor
    .executeQuery(ExpressionStoreQuery.java:783)
    at
    org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1005)
    

Problem conclusion

  • With this fix, code has been added to OpenJPA to ensure that a
    JPA query with Date literals can be run multiple times.
    
    The fix for this APAR is currently targeted for
    inclusion in Service Levels (Fix Packs) 8.0.0.13 and 8.5.5.3 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

    PI13616

  • Reported component name

    WEBS APP SERV N

  • Reported component ID

    5724H8800

  • Reported release

    850

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2014-03-12

  • Closed date

    2014-06-20

  • Last modified date

    2016-09-12

  • 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

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

Document Information

Modified date:
28 April 2022