org.hibernate.dialect.lock

Class UpdateLockingStrategy

Implemented Interfaces:
LockingStrategy

public class UpdateLockingStrategy
extends java.lang.Object
implements LockingStrategy

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

This strategy is not valid for read style locks.

Author:
Steve Ebersole
Since:
3.2

Constructor Summary

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

Method Summary

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

Constructor Details

UpdateLockingStrategy

public UpdateLockingStrategy(Lockable lockable,
                             LockMode lockMode)
Construct a locking strategy based on SQL UPDATE statements.
Parameters:
lockable - The metadata for the entity to be locked.
lockMode - Indictates the type of lock to be acquired. Note that read-locks are not valid for this strategy.

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