我们可以通过
关闭会话sessionfactory=new Configuration().configure().buildSessionFactory();
session = sessionfactory.openSession();
session.close();
sessionfactory.close();
假设已观察到一个缓慢的查询,并希望关闭它并且应该释放数据库...
1) When does DB thread gets killed on the above code on - session.close() or sessionFactory.close()
2) Difference between session.close() vs sessionFactory.close()
3) Which is a best practice - to close the session or close the factory
4) When we force to close the session or session factory - will commit will be called and
close will be executed or it will be closed without commit ?
我认为我们需要关闭会议。提交事务后,会话将关闭。但是,在这种情况下,我们只想中断查询,但要保留先前的插入或更新。
请详细帮助我。
谢谢