-->
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.  [ 1 post ] 
Author Message
 Post subject: Problem using Hibernate in servlet destroy()
PostPosted: Mon Jan 10, 2011 10:42 am 
Newbie

Joined: Mon Jan 10, 2011 10:33 am
Posts: 1
hello everybody

I'm using apache tomcat 6.0 and hibernate 3.6. My web app is implemented as a servlet that serves http POST and GET.
As well I'm using the singleton pattern for creating a SessionFactory over the HibernateUtil class introduced in the hibernate tutorial.

Now I cant find a solution for following problem. I need a way to access to my db over hibernate in the process of "destroy()" in the servlet class, because i need to save some data when the web app is forced to shut down (e.g. through the tomcat manager).
I always get this error "org.hibernate.HibernateException: No CurrentSessionContext configured!", because tomcat releases the jdbc driver before destroy() of the servlet is called.
Using ServletContext contextDestroyed() is not working as well.

Anybody knows a way or work around to solve this problem?

Cheers Alex


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.