-->
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: proper session management
PostPosted: Mon Jan 09, 2006 2:34 pm 
Newbie

Joined: Fri Dec 17, 2004 12:54 pm
Posts: 13
Hi,
I'm using Hibernate in a web application framework and have a thread local object that has a method used by a lot of different classes during the request cycle to get a hibernate session.

In regards to this I'm stuck on something very simple. When a class requests a session does the thread local object call sessionfactory.createSession() for each getSession() request or does it create the session just once at the begining of the page request cycle and return a reference to that single session object in the getSession() method?

If a session should be created for each call to getSession() then what is the point of using a thread local object?

Thanks for any input.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 11, 2006 4:07 am 
Regular
Regular

Joined: Tue Dec 14, 2004 5:21 am
Posts: 104
Location: india
this is because the session is not thread safe . you can refer ThreadLocal implementation

_________________
sHeRiN
thanks for your ratings ...... :)


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.