getCurrentSession与openSession()有何本质区别?
- 内容介绍
- 文章标签
- 相关推荐
本文共计1268个文字,预计阅读时间需要6分钟。
getCurrentSession与openSession的区别:1. getCurrentSession创建的session会绑定到当前线程,而openSession不会。2. getCurrentSession创建的线程会在事务回滚或事务提交后自动关闭,而openSession必须手动关闭。
1 getCurrentSession创建的session会和绑定到当前线程,而openSession不会。
本文共计1268个文字,预计阅读时间需要6分钟。
getCurrentSession与openSession的区别:1. getCurrentSession创建的session会绑定到当前线程,而openSession不会。2. getCurrentSession创建的线程会在事务回滚或事务提交后自动关闭,而openSession必须手动关闭。
1 getCurrentSession创建的session会和绑定到当前线程,而openSession不会。

