Can one EntityManager (Hibernate) participate in multiple concurrent transactions?

Is there a way one EntityManager can participate in multiple concurrent transactions?

Well, not that at the same time. Something like:

  • Start tx 1
  • Make stuff in tx 1
  • Start tx 2
  • Make stuff in tx 2
  • Commit tx 2
  • Attach tx 1 back
  • Make stuff in tx 1
  • Commit tx 1

with steps sequential one at a time, not overlapping.

+2


source to share


1 answer


Separate transactions? No, he can not.

Attempting to call EntityTransaction.begin () on the currently active transaction (which you would need to do, directly or indirectly) will result in a throw IllegalStateException

.



Work scope / transaction scope concepts are detailed in the Hibernate EntityManager .

+1


source







All Articles