This content has been marked as final.
Show 3 replies
-
1. Re: My own EntityManager, how to do it?
waynebaylor May 17, 2007 10:59 AM (in response to beligum)I would suggest using an Entity Access Object (DAO for EJB3) for your entity beans. Within the EAO you could use the EntityManager to make the additional changes you need OR you could call on other EAOs to make the changes for you. This way you don't have to reinvent the entity manager wheel.
-
2. Re: My own EntityManager, how to do it?
alexg79 May 18, 2007 10:09 AM (in response to beligum)I was about to ask the same question, but then I saw this post. My solution is to just use
@EJB ExtEntityManager em;
instead of@PersistenceContext EntityManager em;
, but if you use multiple persistence units, it may not be such a practical approach. -
3. Re: My own EntityManager, how to do it?
alexg79 May 18, 2007 10:20 AM (in response to beligum)If you need to handle multiple persistence contexts with the same entity manager, you could implement your own PersistenceProvider and overriding Hibernate's methods as necessary to make EntityManagerFactories churn out your own entity manager objects.