Page 1 of 1

About Question enthuware.oce-jpad.v6.2.457 :

Posted: Tue Jul 17, 2018 6:39 pm
by dfigueira
Regarding the explanation of application managed extended persistence context:
An extended persistence context obtained from the application-managed entity manager is a stand-alone persistence context—it is not propagated with the transaction.
but from JPA 2.0 spec:
An application-managed entity manager may be either a JTA entity manager or a resource-local entity
manager.
The persistence context is propagated across the entity manager instances as the JTA transaction is
propagated.
If an entity manager is then invoked from within the component:
  • Invocation of an entity manager defined with PersistenceContext-
    Type.EXTENDED will result in the use of the existing extended persistence context
    bound to that component.
If a component is called and the JTA transaction is propagated into that component:
  • if there is a persistence context bound to the JTA transaction, that persistence con-
    text is propagated and used
Can we conclude that it will be propagated with the transaction (if the JTA transaction is propagated)?

Re: About Question enthuware.oce-jpad.v6.2.457 :

Posted: Tue Jul 17, 2018 7:35 pm
by admin
No, the propagation that is being talked about here is to different components of a distributed application i.e. to different process spaces (and not about propagating it to a different component within the same process space).
Section 7.7 of the JPA 2.0 spec clearly says, "An extended persistence context obtained from the application-managed entity manager is a stand-alone persistence context—it is not propagated with the transaction."
In a distributed application, the transaction will propagate across process boundaries but not the persistence context.