getCurrentSession 与 openSession() 的差异

getCurrentSession 与 openSession() 的区别1 getCurrentSession创建的session会和绑定到当前线程,而openS

getCurrentSession 与 openSession() 的区别

1 getCurrentSession创建的session会和绑定到当前线程,而openSession不会。

2 getCurrentSession创建的线程会在事务回滚或事物提交后自动关闭,而openSession必须手动关闭

这里getCurrentSession本地事务(本地事务:jdbc)时 要在配置文件里进行如下设置

* 如果使用的是本地事务(jdbc事务)

?

?

?

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/LoveYouT/archive/2009/05/17/4193894.aspx