Top Description Fields Constructors Methods
org.hibernate.dialect.lock

public Class OptimisticForceIncrementLockingStrategy

extends Object
implements LockingStrategy
Class Inheritance
All Implemented Interfaces
org.hibernate.dialect.lock.LockingStrategy
Imports
java.io.Serializable, org.hibernate.HibernateException, .LockMode, org.hibernate.action.internal.EntityIncrementVersionProcess, org.hibernate.engine.spi.EntityEntry, .SharedSessionContractImplementor, org.hibernate.event.spi.EventSource, org.hibernate.persister.entity.Lockable

An optimistic locking strategy that forces an increment of the version (after verifying that version hasn't changed). This takes place just prior to transaction commit.

This strategy is valid for LockMode.OPTIMISTIC_FORCE_INCREMENT

Author
Scott Marlow
Since
3.5

Field Summary

Modifier and TypeField and Description
private final Lockable
private final LockMode

Constructor Summary

AccessConstructor and Description
public
OptimisticForceIncrementLockingStrategy(Lockable
The metadata for the entity to be locked.
lockable
,
LockMode
Indicates the type of lock to be acquired.
lockMode
)

Construct locking strategy.

Method Summary

Modifier and TypeMethod and Description
protected LockMode
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.hibernate.dialect.lock.LockingStrategy.lock.

Acquire an appropriate type of lock on the underlying data that will endure until the end of the current transaction.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

lockableback to summary
private final Lockable lockable
lockModeback to summary
private final LockMode lockMode

Constructor Detail

OptimisticForceIncrementLockingStrategyback to summary
public OptimisticForceIncrementLockingStrategy(Lockable lockable, LockMode lockMode)

Construct locking strategy.

Parameters
lockable:Lockable

The metadata for the entity to be locked.

lockMode:LockMode

Indicates the type of lock to be acquired.

Method Detail

getLockModeback to summary
protected LockMode getLockMode()
lockback to summary
public void lock(Serializable id, Object version, Object object, int timeout, SharedSessionContractImplementor session)

Implements org.hibernate.dialect.lock.LockingStrategy.lock.

Doc from org.hibernate.dialect.lock.LockingStrategy.lock.

Acquire an appropriate type of lock on the underlying data that will endure until the end of the current transaction.

Parameters
id:Serializable

The id of the row to be locked

version:Object

The current version (or null if not versioned)

object:Object

The object logically being locked (currently not used)

timeout:int

timeout in milliseconds, 0 = no wait, -1 = wait indefinitely

session:SharedSessionContractImplementor

The session from which the lock request originated

Annotations
@Override