aspose file tools*
The moose likes Object Relational Mapping and the fly likes How bad is close EM always ? 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 "How bad is close EM always ?" Watch "How bad is close EM always ?" New topic
Author

How bad is close EM always ?

Robert Siqueira
Ranch Hand

Joined: Jan 21, 2008
Posts: 37
Hi,

I have the following entitymanager producer:



Is there any impact about always close the entitymanger after closed a transaction !??!!? Is there any performance issues ?

Regards,

Robert
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1632
    
    7

If you use dependency injection to get it using the @PersistenceContext annotation then you should not close it as this is handled for you. However if you are creating it from the factory as you are in your snippet then absolutely it is your responsibility to make sure it gets closed every time.


[How To Ask Questions][Read before you PM me]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How bad is close EM always ?
 
Similar Threads
EntityManager in Servlets Doubt
How to create a Template for EntityManager in a WebApplication
Weld 1.0.1-Final: Conversation Scope bean keeps recreated even after beginning conversation ?
CDI do not manage Entitymanager
JEE example with EJB, JSF is not working