|
EclipseLink 2.0.0_ 2.0.0.v20090424-r4050 API Reference | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||
java.lang.Objectjava.lang.Enum<LockModeType>
javax.persistence.LockModeType
public enum LockModeType
Six lock mode types are defined: OPTIMISTIC, OPTIMISTIC_FORCE_INCREMENT, PESSIMISTIC_READ, PESSIMISTIC_WRITE, PESSIMISTIC_FORCE_INCREMENT, NONE. The lock mode type values READ and WRITE are synonyms of OPTIMISTIC and OPTIMISTIC_FORCE_INCREMENT respectively. The latter are to be preferred for new applications.
Lock modes OPTIMISTIC and OPTIMISTIC_FORCE_INCREMENT are used for optimistic locking. The semantics of requesting locks of type LockModeType.OPTIMISTIC and LockMode- Type.OPTIMISTIC_FORCE_INCREMENT are the following.
If transaction T1 calls lock(entity, LockModeType.OPTIMISTIC) on a versioned object, the entity manager must ensure that neither of the following phenomena can occur:
Lock modes PESSIMISTIC_READ, PESSIMISTIC_WRITE, and PESSIMISTIC_FORCE_INCREMENT are used to immediately obtain long-term database locks. The semantics of requesting locks of type LockModeType.PESSIMISTIC_READ, LockMode- Type.PESSIMISTIC_WRITE, and LockModeType.PESSIMISTIC_FORCE_INCREMENT are the following.
If transaction T1 calls lock(entity, LockModeType.PESSIMISTIC_READ) or lock(entity, LockModeType.PESSIMISTIC_WRITE)on an object, the entity manager must ensure that neither of the following phenomena can occur:
EntityManager.find(Class, Object, LockModeType),
EntityManager.find(Class, Object, LockModeType, java.util.Map),
EntityManager.getLockMode(Object),
EntityManager.lock(Object, LockModeType),
EntityManager.lock(Object, LockModeType, java.util.Map),
EntityManager.refresh(Object, LockModeType),
EntityManager.refresh(Object, LockModeType, java.util.Map),
NamedQuery.lockMode(),
Query.getLockMode()| Enum Constant Summary | |
|---|---|
NONE
No locking |
|
OPTIMISTIC
Equivalent to READ lock |
|
OPTIMISTIC_FORCE_INCREMENT
Equivalent to WRITE lock |
|
PESSIMISTIC_FORCE_INCREMENT
|
|
PESSIMISTIC_READ
|
|
PESSIMISTIC_WRITE
|
|
READ
Read lock READ is synonymous with OPTIMISTIC. |
|
WRITE
Write lock WRITE is synonymous with OPTIMISTIC_FORCE_INCREMENT. |
|
| Method Summary | |
|---|---|
static LockModeType |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. |
static LockModeType[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
| Methods inherited from class java.lang.Enum |
|---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Enum Constant Detail |
|---|
public static final LockModeType READ
public static final LockModeType WRITE
public static final LockModeType OPTIMISTIC
public static final LockModeType OPTIMISTIC_FORCE_INCREMENT
public static final LockModeType PESSIMISTIC_READ
public static final LockModeType PESSIMISTIC_WRITE
public static final LockModeType PESSIMISTIC_FORCE_INCREMENT
public static final LockModeType NONE
| Method Detail |
|---|
public static LockModeType[] values()
for (LockModeType c : LockModeType.values()) System.out.println(c);
public static LockModeType valueOf(java.lang.String name)
name - the name of the enum constant to be returned.
java.lang.IllegalArgumentException - if this enum type has no constant
with the specified name
java.lang.NullPointerException - if the argument is null
|
EclipseLink 2.0.0_ 2.0.0.v20090424-r4050 API Reference | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||