session的openSession()方法与getCurrentSession()方法的区别
来源:互联网 发布:公路预算软件 编辑:程序博客网 时间:2024/06/05 17:06
session的openSession()方法和getCurrentSession()方法有很大区别,用的时候要分清。
在hibernate中,当要保存记录时,我们要用到session的save()方法,所以需要得到session,得到session
要用到openSession()方法或getCurrentSession()方法。
openSession()方法:每次得到的session都是新的,而且在用完后需要调用session的close()方法关闭。
getCurrentSession()方法:是从上下文中找,如果存在session,则就用旧的;如果没有,就会建新的session。
调用getCurrentSession()方法不需要close,因为在事务提交时已经自动close。
——空气还在,希望还在。
- session的openSession()方法与getCurrentSession()方法的区别
- openSession()和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() 的区别
- Android TextView设置字体风格
- Tomcat绑定域名
- 编译WINCE6.0版本VLC
- 客户端MVC架构
- c语言 优先级
- session的openSession()方法与getCurrentSession()方法的区别
- STC8951单片机内部存储
- Ogre中文字类的纹理贴到三维物体中
- String md5 加密
- wchar_t 的输出问题
- javadoc生成API 常见问题
- 指针与数组
- 多系统之间大数据量增量同步解决方案
- tileMap中GID的认识