Add locking module: optimistic vs pessimistic locking on Hibernate 7.4.14.Final

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YPgGH6aMbSLANL3E2HHmS6
This commit is contained in:
2026-10-25 17:01:49 +00:00
co-authored by Claude Sonnet 5.5
parent 807f681ed1
commit 357ba84e5c
18 changed files with 758 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
same race, entity has @Version
A: committed. B: failed
B exception: jakarta.persistence.OptimisticLockException
caused by: org.hibernate.StaleObjectStateException
final balance: 110, version: 1
update statements Hibernate sent:
update VersionedAccount set balance=?,owner=?,version=? where id=? and version=?
update VersionedAccount set balance=?,owner=?,version=? where id=? and version=?