Class PessimisticLockingPolicy
java.lang.Object
org.eclipse.persistence.descriptors.PessimisticLockingPolicy
- All Implemented Interfaces:
Serializable
,Cloneable
Description: This policy is used to configure bean level pessimistic locking feature. It is set on the CMPPolicy instance of the ClassDescriptor Note that bean is not pessimistic locked in the following scenarios:
- No presence of a JTA transaction
- The current transaction is created and started by the Container for the invoking entity bean's method only. (i.e. invoke a business method without a client transaction)
- The bean has already been pessimistic locked in the current transaction
- Execution of ejbSelect
- Traversing relationship does not lock the returned result.
Responsibilities:
- Configure locking modes of WAIT or NO_WAIT
- Provide utility to configure an ObjectLevelReadQuery with pessimistic locking based on this policy.
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
INTERNAL: Clone the policyshort
PUBLIC: Return locking mode.void
setLockingMode
(short mode) PUBLIC: Set locking mode.
-
Field Details
-
lockingMode
protected short lockingMode
-
-
Constructor Details
-
PessimisticLockingPolicy
public PessimisticLockingPolicy()
-
-
Method Details
-
getLockingMode
public short getLockingMode()PUBLIC: Return locking mode. Default locking mode is ObjectLevelReadQuery.LOCK.- Returns:
- short locking mode value of ObjectLevelReadQuery.LOCK or ObjectLevelReadQuery.LOCK_NOWAIT
-
setLockingMode
public void setLockingMode(short mode) PUBLIC: Set locking mode. If the mode is not a valid value, the locking mode is unchanged.- Parameters:
mode
- must be value of ObjectLevelReadQuery.LOCK or ObjectLevelReadQuery.LOCK_NOWAIT
-
clone
INTERNAL: Clone the policy
-