Optimistic locking

Optimistic locking detects concurrent modifications without blocking rows: a @Version attribute is incremented on every update, and an update based on a stale version fails (OptimisticLockException). The application can then reload the data and retry or warn the user.

Example

@Version
private long version;

Related concepts

The whole glossary