Chapter 8. Transactions 153
Test
During the test you can observe this behavior:
❑ When you open twice a CustomerDetailsView for the same Customer
object,you canchange itin both views without an error. The last view that
you save wins, and the conflict is not detected. Why? In this sample
optimistic locking is used, copy-on-read to be precise, and no optimistic
predicate was defined. That is we allow collisions but we do not detect
them. You could try to avoid that several CustomerDetailsViews can be
openedfor the sameCustomerobject within the same application, butthis
still would not solve the potential risk of collisions, because another user
still could change the same Customer object in the meantime. So the best
solution when you use copy-on-read ...