-->
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: Closing db connection issue
PostPosted: Mon Feb 07, 2011 12:08 pm 
Newbie

Joined: Mon Sep 06, 2010 5:49 am
Posts: 3
Hi All,
Am fairly new to use hibernate, please help to answer my simple doubt, its more of a design oriented doubt.

I have configured the hibernate properties to have min of 5 connections and max of 30 connections in the connection pool initially and configured as minimum idle connections as 5 to have always minimum of 5 connections available to serve the requests.
In the application code am closing the connection which I have taken from the data source, we use spring to configure the data source and hibernate sessions. I am not closing the data source nor sessions but closing the connection objects in the code.
My doubt is even if i closed the connection will the hibernate takes care of creating connection objects even when there is no request comes in to match the configuration as min of 5 connections should be available at any time?
Do we really need to take care of closing the connection object in application by ourself?

Regards
Subash


Top
 Profile  
 
 Post subject: Re: Closing db connection issue
PostPosted: Mon Feb 07, 2011 1:06 pm 
Newbie

Joined: Sun Mar 07, 2010 9:05 am
Posts: 13
What connection objects are you talking about?

Hibernate helps you (among other things) by hiding the JDBC connection details to you (you use the session).

If you are already using Spring, you could look at the HibernateTemplate class that helps you remove boilerplate code (like getting a session etc.).


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.