aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillaume Nodet <gno...@gmail.com>
Subject Re: Aries JPA container managed with no active transactions
Date Thu, 26 Jul 2012 13:49:42 GMT
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 <bcanhome@googlemail.com>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é <jb@nanthrax.net>:
> > 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 <gnodet@gmail.com>
> 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é
> > jbonofre@apache.org
> > 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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message