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:
@@ -0,0 +1,8 @@
|
||||
A locks row 1 with PESSIMISTIC_WRITE, holds it 600 ms, deposits 10
|
||||
B asks for the same lock, then deposits 20
|
||||
B waited at least 400 ms for the lock: true
|
||||
final balance: 130 (correct: 130)
|
||||
|
||||
select statements Hibernate sent (one per transaction):
|
||||
select a1_0.id,a1_0.balance,a1_0.owner from Account a1_0 where a1_0.id=? for update
|
||||
select a1_0.id,a1_0.balance,a1_0.owner from Account a1_0 where a1_0.id=? for update
|
||||
Reference in New Issue
Block a user