I have an ear application running on JBoss 4.2.1 GA that contains 2 EJB Stateless jar's. I have only one persistence unit define in the persistence.xml of only one of the jar/META-INF.
All is container-managed, so JTA is used and I don't need to manage transaction. The isolation level of my DB is read_commited.
In the first EJB jar, the EntityManager is injected (@PersistenceContext).
In the second one, the Entity manager is retrieved by Spring and JNDI (but should be the same as the one used in the first EJB) as follow:
<bean id="jpaTemplate" class="org.springframework.orm.jpa.JpaTemplate"> <property name="entityManager" ref="entityManagerBPM" /> </bean> <jee:jndi-lookup id="entityManagerBPM" jndi-name="persistence/manager1"/>