This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
The Pro EJB 3 book dictates on page 112 that the JPA defines no less than 3 different types of EntityManager. I can see only two of them, namely the Container Managed Entity Manager and the Application Managed Entity Manager. Which is the third one? Or is that simply a typo from the book?
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
There are two container-managed entity managers. The first one is transaction-scoped entity manager and the second one is extended entity manager. Both described on page 112 and on page 113. There is also application-managed entity manager described on page 117.
The extended and transaction scoped are subtypes for the Container Managed Entity Manager. But what about Application Managed Entity Manager. Can't they also be transaction scoped or extended scoped? Correct me if I'm wrong!
The extended and transaction scoped are subtypes for the Container Managed Entity Manager. But what about Application Managed Entity Manager. Can't they also be transaction scoped or extended scoped? Correct me if I'm wrong
There are two ways of using the EntityManager
1) Container Managed ::: Using Dependency Injection ...so the container is responsible for initializing the EntityManager
2) Application Managed::: User or Application is Responsible for creating and initializing the EntityManager
EntityManagerFactory emf = Persistence.createEntityManagerFactory("MyUnit")
EntityManager em = emf.createEntityManager();
Now coming back to Transaction or Extended ..those are the Persistence Context Types.
Container Managed Entity Manager can have any of the below Persistent Context Type