Description
Current Cayenne JPA EntityManager is always RESOURCE_LOCAL, i.e. it manages its own transactions via EntityTransaction interface. We need to support the JTA and RESOURCE_LOCAL managers. The details are described in chapter 5.9.2 of the specification. Specifically for JTA EntityManagers:
- When EntityManagerFactory.createEntityManager is invoked, the provider must create and return a new entity manager. If a JTA transaction is active, the provider must register for synchronization notifications against the JTA transaction.
• When EntityManager.joinTransaction is invoked, the provider must register for synchronization notifications against the current JTA transaction if a previous joinTransaction invocation for the transaction has not already been processed.
• When the JTA transaction commits, the provider must flush all modified entity state to the database.
• When the JTA transaction rolls back, the provider must detach all managed entities.
.....