The wording you point out is interesting to me... 7.7 is the section for app-managed contexts. In that context I'm not really sure what "the persistence context remains managed until the transaction completes" means.
With an app-managed context that comes from a jpa container managed EMF, the application can call em.joinTransaction() to join a JTA transaction, unless the context is configured to be resource_local. Section 7.7 has more text than I pasted, it also describes the app-managed contexts being joined to JTA transactions (for which subsequent calls to em.getTransaction() will throw ISE):
When a JTA application-managed entity manager is used, an application-managed persistence context may be specified to be of type SynchronizationType.UNSYNCHRONIZED. A persistence con-
text of type SynchronizationType.UNSYNCHRONIZED is not enlisted in any JTA transaction unless explicitly joined to that transaction by the application. A persistence context of type Synchro-
nizationType.UNSYNCHRONIZED is enlisted in a JTA transaction and registered for subsequent transaction notifications against that transaction by the invocation of the EntityManager join-
Transaction method. The persistence context remains joined to the transaction until the transaction commits or rolls back. After the transaction commits or rolls back, the persistence context will not be
joined to any subsequent transaction unless the joinTransaction method is invoked in the scope of that subsequent transaction.
|