Hi, on p. 295 of specification about persistence context:
If the component is a stateful session bean to which an extended persistence context has been
bound and there is a different persistence context bound to the JTA transaction, an EJBException
is thrown by the container.
I modified txScopedPersistenceContext example in the JPA Pro:
The employee service stateful bean's persistence context is in a JTA transaction (CMT). But when the audit service's logTransaction2 is called, a different persistence context associated with the audit service bean is bound to the same JTA.
At first, I thought the audit service will throw an exception as described by the quote.
But why it does not ?
posted 2 years ago
I think I can answer my own question after I read the following Hibernate document:
If a stateful session bean with an extended persistence context calls a stateless session bean or a stateful session bean with a transaction-scoped persistence context in the same JTA transaction, the persistence context is propagated.