public static interface Session.LockRequest
Modifier and Type | Field and Description |
---|---|
static int |
PESSIMISTIC_NO_WAIT
Constant usable as a time out value that indicates no wait semantics should be used in
attempting to acquire locks.
|
static 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).
|
Modifier and Type | Method and Description |
---|---|
LockMode |
getLockMode()
Get the lock mode.
|
boolean |
getScope()
Check if locking is cascaded to owned collections and relationships.
|
int |
getTimeOut()
Get the timeout setting.
|
void |
lock(Object object)
Perform the requested locking.
|
void |
lock(String entityName,
Object object)
Perform the requested locking.
|
Session.LockRequest |
setLockMode(LockMode lockMode)
Specify the LockMode to be used.
|
Session.LockRequest |
setScope(boolean scope)
Specify if LockMode should be cascaded to owned collections and relationships.
|
Session.LockRequest |
setTimeOut(int timeout)
Specify the pessimistic lock timeout (check if your dialect supports this option).
|
static final int PESSIMISTIC_NO_WAIT
static final int PESSIMISTIC_WAIT_FOREVER
LockMode getLockMode()
Session.LockRequest setLockMode(LockMode lockMode)
lockMode
- The lock mode to use for this requestint getTimeOut()
Session.LockRequest setTimeOut(int timeout)
timeout
- is time in milliseconds to wait for lock. -1 means wait forever and 0 means no wait.boolean getScope()
Session.LockRequest setScope(boolean scope)
cascade="lock"
for scope=true to work.scope
- true
to cascade locks; false
to not.this
, for method chainingvoid lock(String entityName, Object object)
entityName
- The name of the entity to lockobject
- The instance of the entity to lockvoid lock(Object object)
object
- The instance of the entity to lockCopyright © 2001-2021 Red Hat, Inc. All Rights Reserved.