Class OptimisticLockModeEvent
java.lang.Object
io.hypersistence.optimizer.core.event.AbstractEvent
io.hypersistence.optimizer.hibernate.event.session.SessionEvent
io.hypersistence.optimizer.hibernate.event.session.ManagedEntityEvent
io.hypersistence.optimizer.hibernate.event.session.OptimisticLockModeEvent
- All Implemented Interfaces:
Event,Serializable
The
OptimisticLockModeEvent indicates that a managed entity was locked using the
LockModeType.OPTIMISTIC mode without having the associated database record locked with the
LockModeType.PESSIMISTIC_READ or LockModeType.PESSIMISTIC_WRITE
strategy.
Without locking the underlying record, there's a window of opportunity between the
version check and the transition commit, in which time the entity could still be changed by a concurrent transaction,
therefore defeating the purpose of this optimistic locking mechanism.
Ideally, the LockModeType.PESSIMISTIC_READ or
LockModeType.PESSIMISTIC_WRITE should be acquired right before
exiting the service method that triggers the transaction commit.- Since:
- 2.5.0
- Author:
- Vlad Mihalcea
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.hypersistence.optimizer.core.event.Event
Event.Priority -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class io.hypersistence.optimizer.hibernate.event.session.ManagedEntityEvent
getEntityClass, getEntityIdentifier, getEntityNameMethods inherited from class io.hypersistence.optimizer.core.event.AbstractEvent
getInfoUrl
-
Constructor Details
-
OptimisticLockModeEvent
-
-
Method Details
-
getPriority
Get theEvent.Priorityof thisEvent- Returns:
- the
Event.Priorityof thisEvent
-
getDescription
-