-->
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: What is diff. between openSession() and getCurrentSession()
PostPosted: Sat May 19, 2007 8:22 am 
Beginner
Beginner

Joined: Fri Aug 12, 2005 7:05 am
Posts: 25
Location: TamilNadu
Hi ,

What is exact difference between openSession() and getCurrentSession() in SessionFactory?

Any piece of example code please.

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 19, 2007 1:47 pm 
Beginner
Beginner

Joined: Fri May 18, 2007 10:28 am
Posts: 48
Location: Madison, WI
Suppose if you have a ThreadLocal associated with you session factory, Opensession method creates a session and drops the session in the current thread
getCurrentSession returns the session that is associated with currentThread, I generally use this method to verify if a connection and session are still active.


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.