IBM Support

PI41555: THE JAVAX.PERSISTENCE.QUERY.TIMEOUT PROPERTY DOESN'T WORK AS EXPECTED

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • A attempt was made to specify a query timeout for 1000ms by
    setting javax.persistence.query.timeout property in the
    persistence.xml file...
    
    --- persistence.xml ---
    <properties>
     <property name="javax.persistence.query.timeout" value="1000"
    />
    </properties>
    -----------------------
    
    It works fine for SELECT query but does not work for UPDATE
    query.  It seems that the UPDATE case interprets this value as
    1000 seconds instead of 1000 milliseconds.  According to the
    following doccument, this property must be set in milliseconds.
    
    JPA Query Setting &amp; Tuning (FlushMode, LockMode)
    http://www.objectdb.com/java/jpa/query/setting
    
    ---
    "javax.persistence.query.timeout" - sets maximum query
    execution time in milliseconds. A QueryTimeoutException is
    thrown if timeout is exceeded.
    ---
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All users of IBM WebSphere Application      *
    *                  Server V8.5.0 and V8.5.5 who make           *
    *                  use of the JPA                              *
    *                  javax.persistence.query.timeout property.   *
    ****************************************************************
    * PROBLEM DESCRIPTION: JPA query timeout doesn't apply to      *
    *                      all EntityManager operations.           *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    The JPA 2.0 Specification defines a property named
    javax.persistence.query.timeout (query timeout for short). As
    its name implies, this property is used to apply apply a
    timeout (in milliseconds) to javax.persistence.Query
    operations. In other words, the property will apply to
    queries. This property doesn't apply to all EntityManager
    operations. However, when an EntityManager 'find' is made,
    and the resultant entity updated, it would stand to reason
    that the query timeout could apply to the find/update
    operation.
    

Problem conclusion

  • With this fix, code has been added to OpenJPA to allow a user
    to indicate that OpenJPA should apply the query timeout to
    EntityManager operations, were applicable, for example in the
    case of an EntityManager find and update. The new code is
    enabled by an OpenJPA property. This property can be set in
    the persistence.xml file or as a JVM system property.  The
    property is named
    'openjpa.jdbc.DBDictionary.allowQueryTimeoutOnFindUpdate'.
    To set this in the persistence.xml file you would add this:
    
    <property name="openjpa.jdbc.DBDictionary"
    value="allowQueryTimeoutOnFindUpdate=true" />
    
    When this property is set to true (default is false), the new
    code will be enabled which will convert the milliseconds to
    seconds, and pass the seconds to the JDBC driver on a
    find/update. In other words, with this property set, the
    query timerout whould behave the same during a find and update
    as it does for a Query update.
    
    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

    PI41555

  • 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

    2015-05-21

  • Closed date

    2015-10-16

  • Last modified date

    2015-10-16

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

Document Information

Modified date:
28 April 2022