IBM Support

PK61396: NATIVE QUERIES WHICH BEGIN WITH "WITH" ARE TREATED AS UPDATE STATEMENTS INSTEAD OF SELECT STATEMENTS IN OPEN JPA.

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as unreproducible.

Error description

  • Some databases support using WITH ${var} AS (SELECT . . .)
    SELECT ${var}, . . . The variable may be used in a future select
    statement.
    Prior to this fix the JPA provider included with WebSphere
    checks whether a native query begins with "select" (case
    insensitive) and throws an exception if an application calls
    getSingleResult() or getResultList() if select isn't found.
    Native queries which begin with "WITH" should be handled in the
    same
    manner as a statement which begins with "SELECT". Please note
    that this support has only been enabled for databases which are
    known to support using the WITH keyword. Currently this feature
    is only supported for DB2 and Oracle.
    .
    The error message that was seen is as follows:
    [2/4/08 12:59:09:279 EST] 0000002e ExceptionUtil E   CNTR0020E:
    EJB
     threw an unexpected (non-declared) exception during invocation
    of method
     "addPayDataEntries" on bean
     "BeanId(xxxxxxxEAR#xxxxxxxXxxxxxxxServiceEJB.jar#xxxDataEntrySe
    rvice,
     null)". Exception data:
    <openjpa-1.0.1-r420667:593705M+10430,14141
     nonfatal user error>
    Customer using "WITH" in his SQL code.
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  IBM WebSphere Application Server users of   *
    *                  JPA native queries                          *
    ****************************************************************
    * PROBLEM DESCRIPTION: The application uses a NativeQuery      *
    *                      which starts with "WITH".               *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    Some databases allow SQL statements to begin with "WITH",
    instead of starting with "SELECT". These statements should be
    treated as normal SELECT statements. The error occurs because
    OpenJPA did not recognize them as SELECT statements and was
    treating them as UPDATE statements. An example error message
    follows :
    org.apache.openjpa.persistence.InvalidStateException: Cannot
    perform a select on
    update or delete query: "WITH <the rest of the statement
    goes here> "
           at org.apache.openjpa.persistence.QueryImpl.
    execute(QueryImpl.java:228)
           at org.apache.openjpa.persistence.QueryImpl.
    getResultList(QueryImpl.java:277)
    
    PK61396 was completed using apar PK60510. Please see PK60510
    for final resolution.
    

Problem conclusion

Temporary fix

Comments

APAR Information

  • APAR number

    PK61396

  • Reported component name

    WAS EJB3 FEATUR

  • Reported component ID

    5724J0851

  • Reported release

    610

  • Status

    CLOSED UR5

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2008-02-20

  • Closed date

    2008-03-05

  • Last modified date

    2008-03-05

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

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

Fix information

Applicable component levels

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"6.1","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
10 February 2022