-->
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.  [ 4 posts ] 
Author Message
 Post subject: tracking down an unclosed session
PostPosted: Tue Oct 25, 2005 11:44 am 
Newbie

Joined: Fri Dec 17, 2004 12:54 pm
Posts: 13
Hi,
I'm running hibernate in a tomcat container and there seems to be a background thread that is printing a message to console saying...

WARNorg.hibernate.jdbc.ConnectionManager [WARN ] - unclosed connection, forgot t
o call close() on your session?


I make a lot of calls to hibernate and am wondering if there is a way where I can get some more info as to what session is open.


Top
 Profile  
 
 Post subject: Re: tracking down an unclosed session
PostPosted: Tue Oct 25, 2005 1:17 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
krebsnet wrote:
Hi,
I'm running hibernate in a tomcat container and there seems to be a background thread that is printing a message to console saying...

WARNorg.hibernate.jdbc.ConnectionManager [WARN ] - unclosed connection, forgot t
o call close() on your session?


I make a lot of calls to hibernate and am wondering if there is a way where I can get some more info as to what session is open.


It's not a background thread. This message is displayed when prior to the ConnectionManager being GC'd in the finalize method.

You need make sure that you are always closing a session prior to returning the response to the User.

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


Top
 Profile  
 
 Post subject: IMO
PostPosted: Tue Oct 25, 2005 1:40 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
The best way to make sure that session/connection get closed is to use some kind of aspectization:
HiveMind based Interceptor from HiveTranse (http://hivetranse.sourceforge.net/ )
Spring based proxy (not HibernateTemplate) http://www.onjava.com/pub/a/onjava/2005 ... tions.html

Or roll your own CGLib based weaver: http://kgionline.com/articles/aop_1/aop1.jsp

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 1:41 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
http://hibernate.org/42.html
http://hibernate.org/43.html


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

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.