One problem I noticed with the HibernateSessionConversationFilter was
that when redeploying my application, the network connection to the
database was not released. I fixed this by implementing destroy() like this:
public void destroy()
{
try
{
if (sessionFactory != null)
{
Session session = sessionFactory.getCurrentSession();
if (session.isOpen()) session.close();
sessionFactory.close();
}
}
catch (HibernateException e)
{
logger.error("Failed to close session in destroy()", e);
}
}
I'm not sure if this code is perfect, but it works for me. The resources
are now properly released when I redeploy the application. |