Looking at the code, it seems that some methods *have* to run inside a transaction, mostly non read-only methods (lock / refresh / persist). I've no idea why is that needed though, not sure it's really related to any synchronization issue.
On Thu, Jul 26, 2012 at 3:42 PM, Achim Nierbeck <[email protected]>wrote: > hmm, interesting. > So this might be related to what a user has reported during this week? > > > http://karaf.922171.n3.nabble.com/Exception-No-transaction-currently-active-td4025308.html > > and actually I have seen this also .... > > regards, Achim > > 2012/7/26 Jean-Baptiste Onofré <[email protected]>: > > Agree. > > > > Thanks for the update. > > > > Regards > > JB > > > > > > On 07/26/2012 03:33 PM, Guillaume Nodet wrote: > >> > >> 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 > >>> > >> > >> > >> > > > > -- > > Jean-Baptiste Onofré > > [email protected] > > http://blog.nanthrax.net > > Talend - http://www.talend.com > > > > -- > > Apache Karaf <http://karaf.apache.org/> Committer & PMC > OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> > Committer & Project Lead > OPS4J Pax for Vaadin > <http://team.ops4j.org/wiki/display/PAXVAADIN/Home> Commiter & Project > Lead > blog <http://notizblog.nierbeck.de/> > -- ------------------------ Guillaume Nodet ------------------------ Blog: http://gnodet.blogspot.com/ ------------------------ FuseSource, Integration everywhere http://fusesource.com
