javax.persistence.lock.timeout Is Set As Seconds Instead of Milliseconds
Last updated on JUNE 09, 2016
Applies to:Oracle WebLogic Server - Version 188.8.131.52.0 and later
Information in this document applies to any platform.
javax.persistence.lock.timeout is defined as "milliseconds" in the JPA specification. But actually, it is set as "seconds" in SQL for Oracle Database.
When javax.persistence.lock.timeout is 10000 (milliseconds), the following SQL is expected.
SELECT KEY1, COL1 FROM LOCKTEST WHERE (KEY1 = ?) FOR UPDATE WAIT 10
but, "10000" is set instead of "10".
184.108.40.206 Lock Mode Properties and Uses
The following property is defined by this specification for use in pessimistic locking, as described in section 3.4.3:
This property may be used with the methods of the EntityManager interface
that allow lock modes to be specified, the Query and TypedQuery setLockMode methods, and the
When specified, this property must be observed. The provider is permitted to
lock more (but not fewer) rows than requested.
The following hint is defined by this specification for use in pessimistic locking.
javax.persistence.lock.timeout // time in milliseconds
Per The Java EE 6 Tutorial - Pessimistic Locking Timeouts :
However, "seconds" is used on WAIT section of select in Oracle Database.
Per Database SQL Language Reference :
The NOWAIT and WAIT clauses let you tell the database how to proceed if the
SELECT statement attempts to lock a row that is locked by another user.
Specify NOWAIT to return control to you immediately if a lock exists.
Specify WAIT to instruct the database to wait integer seconds for the row to
become available and then return control to you.
Sign In with your My Oracle Support account
Don't have a My Oracle Support account? Click to get started
My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms