My Oracle Support Banner

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 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.


but, "10000" is set instead of "10".

Per JSR-000338 Java Persistence 2.1 Specification for Evaluation : 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
NamedQuery annotation.
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 :

The length of time in milliseconds the persistence provider should wait to obtain a lock on the database tables may be specified using the javax.persistence.lock.timeout property.


Per EclipseLink/Development/JPA 2.0/standard properties : 

javax.persistence.lock.timeout - value in milliseconds for pessimistic lock timeout



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!

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.