-->
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: diference between ISession.Close() and ISession.Disconnect()
PostPosted: Sun Jan 29, 2006 12:32 pm 
Newbie

Joined: Thu Jan 19, 2006 7:24 am
Posts: 17
what is the diference between ISession.Close() and ISession.Disconnect()?

How are them associated with IDbConnection ?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 29, 2006 4:08 pm 
Newbie

Joined: Fri Jan 27, 2006 9:03 pm
Posts: 3
When you call session.close(), the session is effectively done. The first level cache is discarded and the session can't be reopened.

Session.Disconnect will release the underlying db connection; however, the first level cache remains. You can reconnect the session (I think the function is actually called session.reconnect), and continue to use the underlying cache. Objects that were attached to the session prior to the disconnect remain attached on the reconnect.

Disconnect can be used when you are waiting for user input. Pull your object out of the database, disconnect the session, allow the user to manipulate the object, reconnect the session, then persist. You should look into optimistic locking if you are going to use this method.

Another way to accomlish this is to create a new session and reattach the object to the new cache with the Lock or Update functions (optimistic locking applies here as well).



Regards,
Trisk


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.