javax.persistence.lock.timeout Is Set As Seconds Instead of Milliseconds
(Doc ID 2101956.1)
Last updated on AUGUST 01, 2018
Applies to:Oracle WebLogic Server - Version 18.104.22.168.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".
22.214.171.124 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.
To view full details, sign in with your My Oracle Support account.
Don't have a My Oracle Support account? Click to get started!
In this Document