session is closed 快疯了


- 如果使用的是getCurrentSession来创建session的话,在commit后,session就自动被关闭了, 也就是不用再session.close()了。但是如果使用的是openSession方法创建的session的话, 那么必须显示的关闭session,也就是调用session.close()方法。这样commit后,session并没有关闭
- 使用SessionFactory.getCurrentSession()需要在hibernate.cfg.xml中如下配置:
- 如果采用jdbc独立引用程序配置如下: thread
- 如果采用了JTA事务配置如下 jta*/