-->
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.  [ 4 posts ] 
Author Message
 Post subject: why closing session
PostPosted: Wed May 07, 2008 7:07 am 
Newbie

Joined: Tue Apr 29, 2008 6:12 am
Posts: 3
I've a stand alone application that uses hibernate. At the moment, when the application starts, it opens a session, which is closed when the application ends.
However, I suppose that opening and clossing sessions is better. But Why? Which is the advantatge of open/close strategy? Is because the database will work faster?

Thanks!


Top
 Profile  
 
 Post subject: RE: why close session
PostPosted: Wed May 07, 2008 7:46 am 
Newbie

Joined: Wed May 07, 2008 3:08 am
Posts: 2
In hibernate openSession means to get a connection to the db and similarly close session means release the connection.
So this is no strategy, its simply getting/releasing a connection to the db.


Top
 Profile  
 
 Post subject: connection pooling
PostPosted: Sun May 11, 2008 9:07 am 
Senior
Senior

Joined: Sun Jun 11, 2006 10:41 am
Posts: 164
Hi,
Hibernate comes with connection pooling. The "hibernate session" does not imply "database session". The connection pool decides, based on config, whether to close/open the physical db connection so don't worry about it. You just need to have a valid "hibernate session" reference and let hibernate do the rest.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 13, 2008 3:24 am 
Newbie

Joined: Tue Apr 29, 2008 6:12 am
Posts: 3
Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.