Class OptimisticLockModeEvent

All Implemented Interfaces:
Event, Serializable

public class OptimisticLockModeEvent extends ManagedEntityEvent
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: