org.hibernate.dialect.lock

Class SelectLockingStrategy

Implemented Interfaces:
LockingStrategy
Known Direct Subclasses:
HSQLDialect.ReadUncommittedLockingStrategy

public class SelectLockingStrategy
extends java.lang.Object
implements LockingStrategy

A locking strategy where the locks are obtained through select statements.

For non-read locks, this is achieved through the Dialect's specific SELECT ... FOR UPDATE syntax.

Author:
Steve Ebersole
Since:
3.2
See Also:
Dialect.getForUpdateString(LockMode), Dialect.appendLockHint(LockMode,String)

Constructor Summary

SelectLockingStrategy(Lockable lockable, LockMode lockMode)
Construct a locking strategy based on SQL SELECT statements.

Method Summary

protected String
generateLockString()
protected LockMode
getLockMode()
void
lock(Serializable id, Object version, Object object, SessionImplementor session)

Constructor Details

SelectLockingStrategy

public SelectLockingStrategy(Lockable lockable,
                             LockMode lockMode)
Construct a locking strategy based on SQL SELECT statements.
Parameters:
lockable - The metadata for the entity to be locked.
lockMode - Indictates the type of lock to be acquired.

Method Details

generateLockString

protected String generateLockString()

getLockMode

protected LockMode getLockMode()

lock

public void lock(Serializable id,
                 Object version,
                 Object object,
                 SessionImplementor session)
            throws StaleObjectStateException,
                   JDBCException
Specified by:
lock in interface LockingStrategy