Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: DBCP object never closed error
PostPosted: Fri Jul 01, 2005 3:20 pm 
Newbie

Joined: Sun May 22, 2005 4:21 pm
Posts: 10
Hi,

I am doing performance testing on an application which uses Hibernate and runs on MySQL and Tomcat. When I run about 100 concurrent users on the site for about 15 minutes, i start to see exceptions with the following error message:

DBCP object created 2005-06-30 11:23:45 by the following code was never closed:
. . . . (followed by a stack trace)

It seems that the database connection isn't closed properly, but I'm not sure how this could be since Hibernate should handle the connections. Has anyone else seen this exception or does anyone know why it could be happening?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 01, 2005 9:06 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
You need to show your transaction code as an example of what you are doing. In anycase, the docs (even the API docs for session) have examples of correct transaction code arrangement.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 05, 2005 9:53 am 
Newbie

Joined: Sun May 22, 2005 4:21 pm
Posts: 10
I'm not sure what you mean by transaction code but I am pasting in the code that is used in my DAO classes. Basically I am using something called a HibernateTemplate that is part of the spring framework. I think the Spring class HibernateDAOSupport, which is extended somewhere, creates the session . . . I don't know if anyone here is familiar with Spring but here is the code anyway, hope this helps:

public class PersonDAOHibernate extends BaseDAOHibernate implements PersonDAO {

public Person getPerson(Long id) {
Person person = (Person) getHibernateTemplate().get(Person.class, id);

if (person == null) {
throw new ObjectRetrievalFailureException(Person.class, id);
}

return person;
}

public void savePerson(Person person) {
getHibernateTemplate().saveOrUpdate(person);
}

public void removePerson(Long id) {
// object must be loaded before it can be deleted
getHibernateTemplate().delete(getPerson(id));
}
}


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 05, 2005 9:57 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Use the Spring forum, we only discuss untainted Hibernate here.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.