Hi all,
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"/>
|
My problem:
- in the first stateless, I do em.persist(bean);
- in the second one (after the persist) I do a em.find(bean.getClass(), bean.getId());
Sometimes the find cannot retrieve the bean. I guess that the transaction of the persist
caller has not been commited.
If you had any idea on how to use the really same instance of the EntityManager between
stateless bean (CMB) please let me know about it.
Thanks
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4119037#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...