-->
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.  [ 3 posts ] 
Author Message
 Post subject: HibernateThreadFilter and releasing JDBC connections
PostPosted: Fri Sep 08, 2006 5:56 am 
Newbie

Joined: Fri Sep 08, 2006 5:44 am
Posts: 2
If using the HibernateThreadFilter and setting the Hibernate property hibernate.current_session_context_class to thread, I'm confused as to whether I need to manually unbind the the Session and close it. I see at http://hibernate.org/42.html it says the "current" Session is automatically closed when the transaction is committed, but at http://blog.hibernate.org/cgi-bin/blosx ... ioncontext it says I need to manually unbind and close the Session. In my logs Hibernate seems to log some confusing messages, telling me that the session is closed and then again reminding me to close the session. This log output was from a simple HelloWorld example that ran a single select for the request.

DEBUG [org.hibernate.jdbc.JDBCContext] 208 - <after transaction completion>
2006-09-08 05:24:42,765 DEBUG [org.hibernate.jdbc.ConnectionManager] 296 - <transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!>
2006-09-08 05:24:42,765 DEBUG [org.hibernate.impl.SessionImpl] 424 - <after transaction completion>
2006-09-08 05:24:42,765 DEBUG [org.hibernate.impl.SessionImpl] 355 - <automatically closing session>
2006-09-08 05:24:42,765 DEBUG [org.hibernate.impl.SessionImpl] 275 - <closing session>
2006-09-08 05:24:42,765 DEBUG [org.hibernate.jdbc.ConnectionManager] 374 - <performing cleanup>
2006-09-08 05:24:42,765 DEBUG [org.hibernate.jdbc.ConnectionManager] 435 - <releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]>
2006-09-08 05:24:42,765 DEBUG [org.hibernate.jdbc.JDBCContext] 208 - <after transaction completion>
2006-09-08 05:24:42,765 DEBUG [org.hibernate.jdbc.ConnectionManager] 296 - <transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!>
2006-09-08 05:24:42,765 DEBUG [org.hibernate.impl.SessionImpl] 424 - <after transaction completion>


Top
 Profile  
 
 Post subject: HibernateThreadFilter and releasing JDBC connections
PostPosted: Mon Sep 11, 2006 7:07 pm 
Newbie

Joined: Tue Sep 27, 2005 5:44 pm
Posts: 13
I'm under the impression that:

<property name="transaction.auto_close_session">true</property>

is required if you use "thread" and want the session automatically closed. Maybe this is a default in 3.x, though.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 12, 2006 3:26 pm 
Newbie

Joined: Fri Sep 08, 2006 5:44 am
Posts: 2
from the documentation it seems that auto closing the session on transaction commit is the default, but there is some conflicting views between the docs and that blog post, as well as the logging....


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.