I understand the differences between optimistic and pessimistic locking. Now could someone explain to me when I would use either one in general?
And does the answer
I would think of one more case when pessimistic locking would be a better choice.
For optimistic locking every participant in data modification must agree in using this kind of locking. But if someone modifies the data without taking care about the version column, this will spoil the whole idea of the optimistic locking.