-->
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.  [ 6 posts ] 
Author Message
 Post subject: motivation for removing some methods from HibernateUtil
PostPosted: Tue Jan 03, 2006 7:31 pm 
Regular
Regular

Joined: Fri Jan 28, 2005 3:11 am
Posts: 81
I noticed that the HibernateUtil class in the newest edition of Caveat emptor no longer contains openSession, closeSession, beginTransaction, and commitTransaction methods, relegating it to the individual action classes to get from the sessionFactory.

What was the motivation behind that?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 03, 2006 8:58 pm 
Hibernate Team
Hibernate Team

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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 03, 2006 9:27 pm 
Regular
Regular

Joined: Fri Jan 28, 2005 3:11 am
Posts: 81
yes, I am quite familiar with those patterns. but while implementing session-in-view, why not invoke those methods from HibernateUtil, as it used to be in the past


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 03, 2006 9:42 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Please re-read the page again. There is no need anymore for a complex HibernateUtil in 3.1, this is all built-in.


Top
 Profile  
 
 Post subject: follow up question
PostPosted: Wed Jan 04, 2006 12:16 am 
Regular
Regular

Joined: Fri Jan 28, 2005 3:11 am
Posts: 81
Thanks, I reread it. More importantly, I looked at the code. So, yes, that part makes sense now - the SessionFactrory.getCurrentSession is doing all that, for example.

Now, I have a follow up question. That page explains that transaction.commit() also closes the session. Now, I looked through the code and was unable to figure out where it does that. Can you shed some light on this for me?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 04, 2006 8:59 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
ThreadLocalSessionContext.java


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