-->
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.  [ 2 posts ] 
Author Message
 Post subject: Does transaction rollback automatically clean up connection
PostPosted: Fri Mar 16, 2007 5:25 pm 
Newbie

Joined: Tue May 04, 2004 3:32 pm
Posts: 16
Location: Iowa
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


I am using CMT (SLSB) and getCurrentSession() api. In the SLSB, if there is an exception thrown, it is caught and the transaction is setRollbackOnly. I am not sure how hibernate handle the hibernate session and database connection in the case of transaction rollback. I suppose hibernate will cleanup the connection and session for us. But one of my coworker who came back from hibernate training said that this is not the case. He said you had to close the hibernate session in your own application code. Otherwise you would have leaked database connection problem. Is that true? If so, what is the best way to gracefully clean up the sessions. We don't have direct access in the ejb to the hibernate sesssion.

Please give advice.

Thanks.

Richard


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 18, 2007 3:23 pm 
Newbie

Joined: Tue May 04, 2004 3:32 pm
Posts: 16
Location: Iowa
Never mind. Found the answer in
http://forum.hibernate.org/viewtopic.ph ... sion+close

Looks like in hibernate 3.1, we don't have to manually close session if a runtime exception is thrown. In 2.x, however, this is necessary.


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