hibernate4.3获取session的方法
来源:互联网 发布:金山软件股价 编辑:程序博客网 时间:2024/06/06 20:46
转自: http://blog.csdn.net/zys_hh/article/details/20715561
getCurrentSession与openSession的区别
getCurrentSession创建的session会和绑定到当前线程,而openSession不会。
getCurrentSession创建的线程会在事务回滚或事物提交后自动关闭,而openSession必须手动关闭
getCurrentSession() 使用当前的session
openSession() 重新建立一个新的session
使用getCurrentSession()时 要在hibernate.cfg.xml文件中进行如下设置
如果使用的是本地事务(jdbc事务)
<property name="hibernate.current_session_context_class">thread</property>
如果使用的是全局事务(jta事务)
<property name="hibernate.current_session_context_class">jta</property>
阅读全文
0 0
- hibernate4.3获取session的方法
- Hibernate4获取Session的代码
- Hibernate4获取session
- Hibernate4中获取SessionFactory的方法
- Hibernate4.3.9获取SessionFactory的方法
- Hibernate4之session核心方法
- Hibernate4 session中的createCriteria方法
- Hibernate4 session中的createCriteria方法
- Hibernate4使用Session获取Connection返回ResultSet
- hibernate4.3.11.Final session factory获取
- Spring3与hibernate4整合,sessionFactory.getCurrentSession()方法获取不到Session对象异常解决办法
- hibernate4 session.flush()的作用
- hibernate4的session一级缓存
- Hibernate、Hibernate4获取SessionFactory对象方法的变化
- Hibernate、Hibernate4获取SessionFactory对象方法的变化
- Hibernate4.x之Session--常用方法
- Hibernate4生命周期和Session核心方法
- hibernate4.3创建SessionFactory的方法
- Hive的安装配置和使用Java连接
- Recurrent visual attention
- 【HDU】 1969 Pie
- TX2017秋招笔试题之geohash编码
- Pointers on C——11 Dynamic Memory Allocation.2
- hibernate4.3获取session的方法
- 欢迎使用CSDN-markdown编辑器
- react-native-redux 简易教程
- Two Sum
- python机器学习及实战代码13-16,程序运行时出现提醒及修改
- 中国地理-一些知识的总结
- Pointers on C——11 Dynamic Memory Allocation.3
- JDK下载、安装和环境变量配置
- vm虚拟机安装centos7,配置网卡