For non-read locks, this is achieved through the Dialect's specific SELECT ... FOR UPDATE syntax. This strategy is valid for LockMode.PESSIMISTIC_WRITE This class is a clone of SelectLockingStrategy.
org.hibernate.dialect.Dialect#getForUpdateString(org.hibernate.LockMode) , org.hibernate.dialect.Dialect#appendLockHint(org.hibernate.LockMode, String)
| Access | Constructor and Description |
|---|---|
| public | PessimisticWriteSelectLockingStrategy(Lockable
The metadata for the entity to be locked. lockable, LockMode Indicates the type of lock to be acquired. lockMode)Construct a locking strategy based on SQL SELECT statements. |
| Modifier and Type | Method and Description |
|---|---|
| protected String | generateLockString(int lockTimeout)
Implements abstract org. |
| public void | lock(Serializable
The id of the row to be locked id, Object The current version (or null if not versioned) version, Object The object logically being locked (currently not used) object, int timeout in milliseconds, 0 = no wait, -1 = wait indefinitely timeout, SharedSessionContractImplementor The session from which the lock request originated session)Implements org. |
| PessimisticWriteSelectLockingStrategy | back to summary |
|---|---|
| public PessimisticWriteSelectLockingStrategy(Lockable lockable, LockMode lockMode) Construct a locking strategy based on SQL SELECT statements. | |
| generateLockString | back to summary |
|---|---|
| protected String generateLockString(int lockTimeout) Implements abstract org. | |
| lock | back to summary |
|---|---|
| public void lock(Serializable id, Object version, Object object, int timeout, SharedSessionContractImplementor session) Implements org. Doc from org. Acquire an appropriate type of lock on the underlying data that will endure until the end of the current transaction.
| |