Actually, given the Entity Manager is not thread safe, I'd rather consider that a bug and synchronize access to it inside the JTAEntityManager by wrapping the detachedEntityManager into a delegate object with all methods synchronized. This would ensure that no concurrency issues will happen.
On Thu, Jul 26, 2012 at 2:12 PM, Guillaume Nodet <[email protected]> wrote: > It seems that when using JPA in container managed mode, an entity manager > is bound to the transaction. > However, when no transactions is active, a single shared entity manager is > used. > Unless I'm wrong, the EntityManager is not thread safe, so all requests to > the DAO that are not inside a transaction will reuse the same entity > manager, and may run into concurrency issues such as OPENJPA-1716 > Shouldn't aries print a warning at least in such cases ? > > -- > ------------------------ > Guillaume Nodet > ------------------------ > Blog: http://gnodet.blogspot.com/ > ------------------------ > FuseSource, Integration everywhere > http://fusesource.com > -- ------------------------ Guillaume Nodet ------------------------ Blog: http://gnodet.blogspot.com/ ------------------------ FuseSource, Integration everywhere http://fusesource.com
