|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hibernate.LockOptions
public class LockOptions
Contains locking details (LockMode, Timeout and Scope).
Field Summary | |
---|---|
static int |
NO_WAIT
Indicates that the database should not wait at all to acquire the pessimistic lock. |
static LockOptions |
NONE
NONE represents LockMode.NONE (timeout + scope do not apply) |
static LockOptions |
READ
READ represents LockMode.READ (timeout + scope do not apply) |
static LockOptions |
UPGRADE
UPGRADE represents LockMode.UPGRADE (will wait forever for lock and scope of false meaning only entity is locked) |
static int |
WAIT_FOREVER
Indicates that there is no timeout for the acquisition. |
Constructor Summary | |
---|---|
LockOptions()
|
|
LockOptions(LockMode lockMode)
|
Method Summary | |
---|---|
static LockOptions |
copy(LockOptions from,
LockOptions dest)
Shallow copy From to Dest |
int |
getAliasLockCount()
Get the number of aliases that have specific lock modes defined. |
Iterator |
getAliasLockIterator()
Iterator for accessing Alias (key) and LockMode (value) as Map.Entry |
LockMode |
getAliasSpecificLockMode(String alias)
Get the LockMode explicitly specified for the given alias via
setAliasSpecificLockMode(java.lang.String, org.hibernate.LockMode)
Differs from getEffectiveLockMode(java.lang.String) in that here we only return
explicitly specified alias-specific lock modes. |
LockMode |
getEffectiveLockMode(String alias)
Determine the LockMode to apply to the given alias. |
LockMode |
getLockMode()
Retrieve the overall lock mode in effect for this set of options. |
boolean |
getScope()
Retrieve the current lock scope setting. |
int |
getTimeOut()
Retrieve the current timeout setting. |
LockOptions |
setAliasSpecificLockMode(String alias,
LockMode lockMode)
Specify the LockMode to be used for a specific query alias. |
LockOptions |
setLockMode(LockMode lockMode)
Set the overall LockMode to be used. |
LockOptions |
setScope(boolean scope)
Set the cope. |
LockOptions |
setTimeOut(int timeout)
Set the timeout setting. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final LockOptions NONE
public static final LockOptions READ
public static final LockOptions UPGRADE
public static final int NO_WAIT
getTimeOut()
,
Constant Field Valuespublic static final int WAIT_FOREVER
getTimeOut()
,
Constant Field ValuesConstructor Detail |
---|
public LockOptions()
public LockOptions(LockMode lockMode)
Method Detail |
---|
public LockMode getLockMode()
per-alias
fashion
public LockOptions setLockMode(LockMode lockMode)
LockMode
to be used. The default is
LockMode.NONE
lockMode
- The new overall lock mode to use.
public LockOptions setAliasSpecificLockMode(String alias, LockMode lockMode)
LockMode
to be used for a specific query alias.
alias
- used to reference the LockMode.lockMode
- The lock mode to apply to the given alias
Query.setLockMode(String, LockMode)
,
Criteria.setLockMode(LockMode)
,
Criteria.setLockMode(String, LockMode)
public LockMode getAliasSpecificLockMode(String alias)
LockMode
explicitly specified for the given alias via
setAliasSpecificLockMode(java.lang.String, org.hibernate.LockMode)
Differs from getEffectiveLockMode(java.lang.String)
in that here we only return
explicitly specified alias-specific lock modes.
alias
- The alias for which to locate the explicit lock mode.
public LockMode getEffectiveLockMode(String alias)
LockMode
to apply to the given alias. If no
mode was explicitly set
, the
overall mode
is returned. If the overall lock mode is
null as well, LockMode.NONE
is returned.
Differs from getAliasSpecificLockMode(java.lang.String)
in that here we fallback to we only return
the overall lock mode.
alias
- The alias for which to locate the effective lock mode.
public int getAliasLockCount()
public Iterator getAliasLockIterator()
public int getTimeOut()
NO_WAIT
and WAIT_FOREVER
represent 2 "magic" values.
NO_WAIT
or WAIT_FOREVER
public LockOptions setTimeOut(int timeout)
getTimeOut()
for a discussion of meaning.
timeout
- The new timeout setting.
getTimeOut()
public boolean getScope()
public LockOptions setScope(boolean scope)
scope
- The new scope setting
public static LockOptions copy(LockOptions from, LockOptions dest)
from
- is copied fromdest
- is copied to
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |