Optimistic locking failure:
I am using a Semaphore to force this execution of concurrents transactions T1 and T2 that cause parallel updates to A/B but it does not throw an OptimisticLockException and roll back.
T1 T2 ---------------------------------------------------------- READ(A) version=1 value=0 | READ(B) version=1 value=0 | | READ(A) version=1 value=0 | READ(B) version=1 value=0 | B = A + B + 20 | WRITE(B) version=2 value=20 A = A + B + 10 | WRITE(A) version=2 value=10 | ----------------------------------------------------------- Results A: version=2 value=10, B: version=2 value=20
Thanks.