-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: EntityManagerFactory close() not closing all EntityManagers
PostPosted: Sun Mar 07, 2010 6:18 pm 
Newbie

Joined: Sat Mar 03, 2007 4:13 pm
Posts: 1
Hi All,

I am using Hibernate 3.4. GA and had a question about the behavior of the EntityManagerFactory close() method. The way I use Hibernate is that I create a single EntityManagerFactory and then use a Factory pattern to lookup an EntityManager from a ThreadLocal and if one does not exist I create one. In order to avoid using a stale EntityManager I check the return value of the isOpen() method on it. When running my unit tests I noticed that I am properly closing the EntityManagerFactory but the EntityManagers created from it still return true for the value of their isOpen() method. Reading the javax.persistence JavaDocs it indicates that closing an EntityManagerFactory should close all resources associated with it including all EntityManager instances created from it. Using a Java debugger I was able to observe that an EntityManager instance returned true from the isOpen() method but the the SessionFactoryImpl that created was closed.

Has anyone else encountered this issue?

Thanks!!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.