Hibernate中openSession 和 getCurrentSession 的区别
来源:互联网 发布:淘宝十元包邮专区 编辑:程序博客网 时间:2024/04/30 06:02
1:Session session = sessionFactory.openSession();
该种方法是创建一个新的session,不论当前的环境中是否已经创建,都会创建;
且当session提交成功后,需要手动关闭这个session;
2:Session session = sessionFactory.getCurrentSession();
该方法是获取当前环境中的session,若环境中已经存在session,则取出当前的;若无session则创建一个新的,
只要当前的session提交后,该session会自动关闭,其后再使用getCurrentSession()方法,则是创建一个新的session;
- Hibernate中openSession 和 getCurrentSession 的区别
- Hibernate 中 openSession()和getCurrentSession() 的区别
- hibernate中 openSession和getCurrentSession的区别
- hibernate中opensession和getCurrentSession的区别
- hibernate中getCurrentSession()和openSession()区别。
- Hibernate SessionFactory中openSession和getCurrentSession方法的区别
- Hibernate SessionFactory中openSession和getCurrentSession方法的区别
- hibernate中openSession()方法和getCurrentSession()方法的区别
- hibernate 的openSession和getCurrentSession的区别
- Hibernate 中getCurrentSession 与 openSession() 的区别
- Hibernate openSession() 和 getCurrentSession的区别
- Hibernate openSession() 和 getCurrentSession的区别
- Hibernate openSession()和getCurrentSession()的区别
- Hibernate openSession() 和 getCurrentSession的区别
- hibernate之openSession()和getCurrentSession()的区别
- Hibernate openSession() 和 getCurrentSession的区别
- hibernate: openSession() 和getCurrentSession()的区别
- Hibernate openSession() 和 getCurrentSession的区别 .
- 卸载mac上老版本的xcode方法
- 关于拒绝服务攻击的一点初步思考
- 关于 java.util.concurrent 您不知道的 5 件事,第 1 部分
- 关于 java.util.concurrent 您不知道的 5 件事,第 2 部分
- libcurl教程
- Hibernate中openSession 和 getCurrentSession 的区别
- Jmeter进行性能测试时多台负载机的配置方法
- win32 com_error: -2147221008 错误解决(转)
- Android中preference的使用
- Hadoop的Eclipse插件使用
- RedHat Enterprise Linux 5 搭建DNS域名服务器(15分钟完成安装)
- 课堂作业02-20
- 多个图片共同飘动
- 常用JQuery插件整理