Junior — Middle
What actions occur if a version inconsistency is detected in optimistic locking?
sobes.tech AI
Answer from AI
In optimistic locking, when a data version conflict is detected, the operation is rolled back and usually an exception is thrown (e.g., OptimisticLockException). This means that someone else has modified the data after the current transaction read it, and to avoid overwriting others' changes, the operation is interrupted. The application can then retry the update with the latest data or notify the user of the conflict.