Open typischmann opened 9 years ago
Usages of JPA would be better, becaust it is more flexible, maintainable and controllable. Then the question is which level of lock should we use for this problem.
One article about the control of cucurrency in JPA is here: https://blogs.oracle.com/carolmcdonald/entry/jpa_2_0_concurrency_and
To implement a lock on the current inventory, there are two possiblities. One is to implement it using Version annotation of JPA. The another is to implement it using select for update in database trigger.