Spring microservices, few nodes, Hibernate, Oracle is the infrastructure. There are few tricky updates to be implemented. We need ACID transactions. Pessimistic locking is slow. So there are two options for optimistic locking. @Version
and a normal @Transactional
annotation and the other option is the prepared statement with 'select for update'. I like the @Version
option more but will it work on multiple nodes?
As every instance of the microservice will have a different entityManager
shall the @Version
work if we have simultaneous execution of two threads on different nodes? (the select for update will work on few nodes for sure but it is older and a bit more complex as a code)
Asked
Active
Viewed 401 times
3
-
Check out https://stackoverflow.com/questions/1616280/java-solutions-for-distributed-transactions-and-or-data-shared-in-cluster – Nikolai Shevchenko Mar 20 '18 at 13:50