Hello All, I am using a spring hibernate application. But when I call getHibernateTemplate(), it goes to some kind of sleep state after 5 to 6 calls to this class. I have changed the way, the spring beans are taken from application context in order to save some development time. Here is what I do:
public class SurveySupportDAO extends HibernateDaoSupport{ private static final Log log = LogFactory.getLog(SurveySupportDAO.class); static ApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] {"applicationContext.xml"}); static SessionFactory bean = (SessionFactory) ctx.getBean("sessionFactory"); public SurveySupportDAO(){ super.setSessionFactory(bean); }
//rest of the functions
}
I just take the sessionFactory bean from applicationContext and in SurveySupportDAO constructor I set it to the parent class's attribute instead of injecting sessionFactory to SurveySupportDAO.
I get the sessionFactory Bean, and I can also call the different functions of getHibernate, But it goes to sleep state after some time. Can anyone suggest me how should I go for this solution?
|