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:
Code:
@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)
Thanks,
Ignacio