3.2.2.9. Update Your Application to Conform to the JPA 2.0 Specification

Summary

The JPA 2.0 specification requires that a persistence context cannot be propagated outside of a JTA transaction. If your application uses only transaction-scoped persistence contexts, the behavior is the same in JBoss Enterprise Application Platform 6 as it was in previous versions of the application server and no changes are required. However, if your application uses an extended persistence context (XPC) to allow queuing or batching of data modifications, you may need to make changes to your application.

Persistence context propagation behavior

If your application has a stateful session bean, Bean1, that uses an extended persistence context, and it calls a stateless session bean, Bean2, that uses a transaction-scoped persistence context, you can expect the following behavior to occur:

  • If Bean1 starts a JTA transaction and makes the Bean2 method invocation with the JTA transaction active, the behavior in JBoss Enterprise Application Platform 6 is the same as previous releases and no change is necessary.
  • If Bean1 does not start a JTA transaction and makes the Bean2 method invocation, JBoss Enterprise Application Platform 6 does not propagate the extended persistence context into Bean2. This behavior is different than in previous releases which did propagate the extended persistence context into Bean2. If your application expects the extended persistence context to be propagated to the bean with the transactional entity manager, you need to change your application to do the invocation within an active JTA transaction.