3.10.3.1. Configuring Default Locking
You can control OpenJPA’s default transactional read and write lock levels through the openjpa.ReadLockLevel and openjpa.WriteLockLevel configuration properties.
Each property accepts a value of none, read, write, optimistic, optimistic-force-increment, pessimistic-read, pessimistic-write, pessimistic-force-increment, or a number corresponding to a lock level defined by the lock manager in use.
These properties apply only to non-optimistic transactions; during optimistic transactions, OpenJPA never locks objects by default.
You can control the default amount of time OpenJPA will wait when trying to obtain locks through the openjpa.LockTimeout configuration property.
Set this property to the number of milliseconds you are willing to wait for a lock before OpenJPA will throw an exception, or to -1 for no limit.
It defaults to -1.
<property name="openjpa.ReadLockLevel" value="none"/>
<property name="openjpa.WriteLockLevel" value="write"/>
<property name="openjpa.LockTimeout" value="30000"/>