getCurrentSession 获得的session 什么时候关闭

最近在看Hibernate3.2,留意到又这样的代码:
try{
  factory.getCurrentSession().beginTransation();
  //do some work
  ...
    factory.getCurrentSession().getTransation.rollback()
}catch(RuntimeException){
  factory.getCurrentSession().getTransation.rollback()
}


没有关闭session的代码,不会是不需要吧?

你可能感兴趣的:(session)