-->
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: Do i have to use threadlocal while using hibernate session?
PostPosted: Wed Mar 07, 2012 4:21 pm 
Newbie

Joined: Wed Mar 07, 2012 4:11 pm
Posts: 1
Hi,

Do i have to use threadlocal while using hibernate session? I've seen many articles which are using threadlocal while dealing with hibernate session but my understanding is that if i'm using factory.getCurrentSession(), we don't need threadlocal (unless there is some other specific requirement for threadlocal) because we'll always get the existing session if available otherwise it will create a new session. We might need threadlocal if we are dealing with entity manager. Is my understanding correct ?

-Pankaj


Top
 Profile  
 
 Post subject: Re: Do i have to use threadlocal while using hibernate session?
PostPosted: Wed Mar 07, 2012 5:15 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
you never need a threadlocal, it's just a convenience (which I personally never use).

_________________
Sanne
http://in.relation.to/


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.