This content has been marked as final.
Show 4 replies
-
1. Re: Seams EntityManager...
wilczarz.wilczarz.gmail.com Sep 24, 2008 11:27 AM (in response to nimo22)Use
@Begin( flushMode = FlushModeType.MANUAL )
No method within the conversation will write the database until you explicitly call entityManager.flush()
-
2. Re: Seams EntityManager...
nimo22 Sep 24, 2008 11:50 AM (in response to nimo22)Thanks but this is not the intention what I want to show:
I have no entityManager-Instance in my View-Bean C and want not to provide a instance as I want to decouple the view from the session-bean.
I cannot call entityManager.flush() in my View Bean C, as I do not want to provide a EntityManager-Instance in my ManagedBean C.
I absolutely want to avoid injecting a EntityManager into a web component (in my case the managedBean C).
I guess, this is the problem:
//retrieves methods from aLocal @In aLocal alocal;
Should I use this instead?:
//retrieves methods from aLocal @EJB aLocal alocal;
-
3. Re: Seams EntityManager...
swd847 Sep 25, 2008 1:04 PM (in response to nimo22)Your problem is that by default the seam managed persistence context will flush itself to the database automatically, unless you either start a conversation with a flush mode of MANUAL or set the flush mode yourself. There is not need to inject an EntityManager to make this change, you can do it through pages.xml (<begin-conversation flush-mode="MANUAL"/>) -
4. Re: Seams EntityManager...
nimo22 Sep 25, 2008 2:35 PM (in response to nimo22)Thank you, I have done that.