This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I have another file that is identical except for the persistence unit name (myPU2). Can I bind both of those to the same factory?
A entity manager factory is == persistence unit. So if you have two persistence units, then it would effectively mean you have two entity manager factories.
Billy Newman wrote:so if an entity manager factory = persistence unit, what is a entity manager = ?
entity manager = persistence *context*
Bobby Anderson
Ranch Hand
Joined: Oct 28, 2008
Posts: 114
posted
0
This is great, thank you. I have one last question.
How do you get a persistence context (entity manager) when you have a persistence unit (entity manager factory)?
I.E.
I define a persistence unit in my persistence.xml file named myPU. How do I inject that?
Seems like I have seen that example before, but it seems incorrect if in fact myPU is a EntityManagerFactory (persistence unit) and not a EntityManager (persistence context).
Billy Newman wrote:
Seems like I have seen that example before, but it seems incorrect if in fact myPU is a EntityManagerFactory (persistence unit) and not a EntityManager (persistence context).
That piece of injection code can be read as "inject a persistence context (entity manager), corresponding to a persistence unit (entity manager factory) named myPU".