3

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)

kryger
  • 12,906
  • 8
  • 44
  • 65
saferJo
  • 497
  • 1
  • 5
  • 16

0 Answers0