File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes EntityManager managed by application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "EntityManager managed by application" Watch "EntityManager managed by application" New topic

EntityManager managed by application

Adolfo Eloy
Ranch Hand

Joined: Mar 21, 2009
Posts: 145

Hello everybody.

I'd like to build a simple solution with JSF and JPA (Hibernate impl). As I'm using tomcat, I think I need to use an entity manager managed by application instead of managed by container.
So I've created an util class that gives EntityManager instances for me as follows in the code below.
I'd like to know if this practice can be used or may cause problems in future because I don't have a way to close my EntityManagerFactory.

Thanks in advance.

Adolfo Eloy
Software Developer
I agree. Here's the link:
subject: EntityManager managed by application
Similar Threads
how to passing parameters to managed beans?
JPA Transaction management
assertion error when unittesting persisting objects
Appropiate place for creating and closing EntityManagerFactory in Application Managed EntityManager
How to create a Template for EntityManager in a WebApplication