openSession与getCurrentSession的区别
来源:互联网 发布:魔幻视频特效软件 编辑:程序博客网 时间:2024/06/10 07:22
Hibernate openSession与getCurrentSession的区别:
1.使用getCurrentSession时要在配置文件中配置属性:
<property name="hibernate.current_session_context_class">thread</property>(使用JDBC事务)
或
<property name="hibernate.current_session_context_class">jta</property>(使用JTA事务)
2.getCurrentSession创建时会自动绑定到当前线程中,openSession不会.
3.openSession要显示地调用close()方法,而getCurrentSession使用后不用关闭,它会在事务提交(commit)或回滚(rollback)时自动关闭.
可以使用getCurrentSession来实现编程式事务
- getCurrentSession 与 openSession() 的区别 getCurrentSession 与 openSession() 的区别
- getCurrentSession 与 openSession() 的区别
- getCurrentSession 与 openSession() 的区别
- getCurrentSession()与openSession()的区别
- getCurrentSession 与 openSession() 的区别
- getCurrentSession 与 openSession() 的区别
- getCurrentSession 与 openSession() 的区别
- openSession与getCurrentSession的区别
- getCurrentSession 与 openSession() 的区别
- getCurrentSession 与 openSession() 的区别
- getCurrentSession 与 openSession() 的区别
- getCurrentSession 与 openSession() 的区别
- getCurrentSession 与 openSession() 的区别 .
- getCurrentSession 与 openSession() 的区别
- openSession与getCurrentSession的区别
- getCurrentSession 与 openSession() 的区别
- getCurrentSession与openSession的区别
- getCurrentSession()与openSession()的区别
- 【礼仪大赛常识】 如何成为诱人焦点:晚装穿法有讲究
- mysql 5.0存储过程学习总结
- 修改注册表,实现开机启动程序
- 我的博客
- LightBox当前页特效显示图片
- openSession与getCurrentSession的区别
- Go 编程语言入门教程 (一)
- pku 1083(DP)
- usaco Chapter 3 section 3.1 Agri-Net
- NET(C#)连接各类数据库-集锦 --【C#网文收集系列】.
- Inner Join 与 Exists 性能对比
- 十条css技巧
- 未婚先性会带给女人严重后果
- 富滇银行 Windows7 无法使用U盾【证书信息读取失败,请选择正确的富滇银行网银证书!】 解决办法