-
1. Re: Spec or Tutorial vague on EntityManagerFactory
bill.burke Jul 6, 2005 10:02 AM (in response to donniedarko)You can use EntityManagerFactory within a JEE app. It is not encouraged though. It is much easier, IMO, to let the container manage the lifecycle of the EntityManager.
-
2. Re: Spec or Tutorial vague on EntityManagerFactory
donniedarko Jul 6, 2005 10:27 AM (in response to donniedarko)I see...but what you are saying is that i must control the entitymanagers lifecycle myself?
Why i'm asking is because in the spec (se quote above) it says quite the opposite - or is that me interpreting the text wrong? -
3. Re: Spec or Tutorial vague on EntityManagerFactory
bill.burke Jul 6, 2005 10:39 AM (in response to donniedarko)Your interpretation is correct. You can use getEntityManager() to obtain a JTA-enabled EntityManager whose lifecylce is managed by the container.
Still, even if you are only using servlets and not using EJBs, why would you ever want to use the factory? Really, the only reason to use EMF within an app server is when you are *not* using EJB and want an EXTENDED persistence context. -
4. Re: Spec or Tutorial vague on EntityManagerFactory
donniedarko Jul 6, 2005 10:56 AM (in response to donniedarko)Well ..the reason is not that I want to use it - it's because i'm forced to do it, since it seems to be the only way to dynamicly change entitymanager on the fly without having to declare them in the code.
See again the ongoing discussion:
http://www.jboss.org/index.html?module=bb&op=viewtopic&t=65869
If I could solve that issue without using EMF no one would be more happy than me...