This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "EntityManager managed by application" Watch "EntityManager managed by application" New topic
Author

EntityManager managed by application

Adolfo Eloy
Ranch Hand

Joined: Mar 21, 2009
Posts: 146

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
OCPJP 6
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EntityManager managed by application