Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

HibernateTemplate.Lock Method

Obtain the specified lock level upon the given object, implicitly checking whether the corresponding database entry still exists (throwing an OptimisticLockingFailureException if not found).

[Visual Basic]
Public NotOverridable Sub Lock( _
   ByVal entity As Object, _
   ByVal lockMode As LockMode _
) _
    Implements ICommonHibernateOperations.Lock
[C#]
public void Lock(
   object entity,
   LockMode lockMode
);

Parameters

entity
The he persistent instance to lock.
lockMode
The lock mode to obtain.

Implements

ICommonHibernateOperations.Lock

Exceptions

Exception Type Condition
ObjectOptimisticLockingFailureException If not found
DataAccessException In case of Hibernate errors

See Also

HibernateTemplate Class | Spring.Data.NHibernate.Generic Namespace