-->
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: Hibernate Session open/close
PostPosted: Fri Jul 02, 2004 10:23 am 
Beginner
Beginner

Joined: Thu Oct 09, 2003 11:41 am
Posts: 39
Location: Paris, France
Hello,

We are currently using the ThreadLocal pattern that envelopes an MBean. I initially thought it would be best to do the following:

1. Request comes in. (Struts execute method - start) Session is open.
2. Some method is called. Instance of the open Session is obtained. Some session operations are run.
3. Another method is called. Same pattern.
.....
10. Finally. Right before rendering the output, the session is closed. (Struts execute method - end)

Should I close the session in every method that obtains the current session via ThreadLocal? Does it makes any sense to open/close the session for every little thing? What is the advantage of ThreadLocal then?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 02, 2004 11:41 am 
Beginner
Beginner

Joined: Mon Jun 07, 2004 4:21 pm
Posts: 44
Location: Boston
Check out this blog for session strategies:

http://blog.hibernate.org/cgi-bin/blosx ... 2004/01/27


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.