程序包 org.hibernate
接口 Session.LockRequest
-
- 封闭接口:
- Session
public static interface Session.LockRequestContains locking details (LockMode, Timeout and Scope).
-
-
字段概要
字段 修饰符和类型 字段 说明 static intPESSIMISTIC_NO_WAITConstant usable as a time out value that indicates no wait semantics should be used in attempting to acquire locks.static intPESSIMISTIC_WAIT_FOREVERConstant usable as a time out value that indicates that attempting to acquire locks should be allowed to wait forever (apply no timeout).
-
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 LockModegetLockMode()Get the lock mode.booleangetScope()Check if locking is cascaded to owned collections and relationships.intgetTimeOut()Get the timeout setting.voidlock(Object object)Perform the requested locking.voidlock(String entityName, Object object)Perform the requested locking.Session.LockRequestsetLockMode(LockMode lockMode)Specify the LockMode to be used.Session.LockRequestsetScope(boolean scope)Specify if LockMode should be cascaded to owned collections and relationships.Session.LockRequestsetTimeOut(int timeout)Specify the pessimistic lock timeout (check if your dialect supports this option).
-
-
-
字段详细资料
-
PESSIMISTIC_NO_WAIT
static final int PESSIMISTIC_NO_WAIT
Constant usable as a time out value that indicates no wait semantics should be used in attempting to acquire locks.- 另请参阅:
- 常量字段值
-
PESSIMISTIC_WAIT_FOREVER
static final int PESSIMISTIC_WAIT_FOREVER
Constant usable as a time out value that indicates that attempting to acquire locks should be allowed to wait forever (apply no timeout).- 另请参阅:
- 常量字段值
-
-
方法详细资料
-
getLockMode
LockMode getLockMode()
Get the lock mode.- 返回:
- the lock mode.
-
setLockMode
Session.LockRequest setLockMode(LockMode lockMode)
Specify the LockMode to be used. The default is LockMode.none.- 参数:
lockMode- The lock mode to use for this request- 返回:
- this LockRequest instance for operation chaining.
-
getTimeOut
int getTimeOut()
Get the timeout setting.- 返回:
- timeout in milliseconds, -1 for indefinite wait and 0 for no wait.
-
setTimeOut
Session.LockRequest setTimeOut(int timeout)
Specify the pessimistic lock timeout (check if your dialect supports this option). The default pessimistic lock behavior is to wait forever for the lock.- 参数:
timeout- is time in milliseconds to wait for lock. -1 means wait forever and 0 means no wait.- 返回:
- this LockRequest instance for operation chaining.
-
getScope
boolean getScope()
Check if locking is cascaded to owned collections and relationships.- 返回:
- true if locking will be extended to owned collections and relationships.
-
setScope
Session.LockRequest setScope(boolean scope)
Specify if LockMode should be cascaded to owned collections and relationships. The association must be mapped withcascade="lock"for scope=true to work.- 参数:
scope-trueto cascade locks;falseto not.- 返回:
this, for method chaining
-
lock
void lock(String entityName, Object object)
Perform the requested locking.- 参数:
entityName- The name of the entity to lockobject- The instance of the entity to lock
-
lock
void lock(Object object)
Perform the requested locking.- 参数:
object- The instance of the entity to lock
-
-