[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Having EntityManagers in different SLSB be "in sync" inside

icordoba do-not-reply at jboss.com
Tue Dec 16 05:59:23 EST 2008

Hi there,
I am having a problem when working with entity managers in different stateless session beans in a same application.
I include them via injection:

	@PersistenceContext(name="myPersistenceContext", unitName="mainPersistenceUnit")
  | 	private EntityManager entityManager;

When working inside a transaction, if an entity manager adds or removes entities and before commiting, a method in another session bean ins invoked, even if its entity manager has the same name and unitName, it will not reflect the changes.
Is this the right behaviour of entity manager? How am I suppoused then to use only one entity manager or, at least, make these entity manager instances to be consistent with the others?

(Of course, not using transactions solves the problem as changes are commited when getting out of every method in the SLSB but I do need transactions here)


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4196839#4196839

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4196839

More information about the jboss-user mailing list