-->
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: usage of threadlocal session
PostPosted: Thu Oct 27, 2005 10:46 am 
Newbie

Joined: Wed Oct 26, 2005 1:18 am
Posts: 2
If using threadlocal sessions (As in HibernateUtil.java)
then does this mean that one should never close the session because if one closes the session, there is no way to "reopen" the session.

As a result does it mean that one has to call sessionfactory.opensession repeatedly for each request ? is keeping the threadlocal session an optimization only or is there anything else to it ? is there any inherent problem with invoking opensession repeatedly other than performance?

thanks.


Top
 Profile  
 
 Post subject: strategy
PostPosted: Thu Oct 27, 2005 12:29 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
There are various strategies
http://www.hibernate.org/42.html
http://www.hibernate.org/43.html

I would say that session-per-request strategy is a good one.
Session is a lightweight object and it is OK to open it on request arrival and then close upon request completion.

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

SourceLabs - dependable OpenSource systems


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.