ssh整合是出现异常: getFlushMode is not valid without active transaction
来源:互联网 发布:碟中谍4 知乎 编辑:程序博客网 时间:2024/06/10 00:05
今天在整合ssh时,tomcat启动时无异常,但是访问action是出现异常
HTTP Status 500 - getFlushMode is not valid without active transaction; nested exception is org.hibernate.HibernateException: getFlushMode is not valid without active transaction
检查配置都没有发现问题,百度发现是hibernate.cfg.xml文件多了<property name="hibernate.current_session_context_class">thread</property>配置,把这行配置注释或者把thread值改成org.springframework.orm.hibernate5.SpringSessionContext可以解决问题。
错误原因:
整合时spring中事务是在配置文件中配置自动开启,因为由getCurrentSession得到的session中是当前线程的session,但是当前线程中没有开启事务的代码,所以不能获transaction 。然而spring+hibernate整合必须要有活动的事务才能执行dao中的方法。
转自:http://m.blog.csdn.net/maoyuanming0806/article/details/61417995
阅读全文
1 0
- ssh整合是出现异常: getFlushMode is not valid without active transaction
- getFlushMode is not valid without active transaction
- getFlushMode is not valid without active transaction
- spring和hibernate整合时异常(详解): getFlushMode is not valid without active transaction
- spring和hibernate整合时异常(详解): getFlushMode is not valid without active transaction
- hibernateTemplate不再出现:spring整合报错getFlushMode is not valid without active transaction
- SSH 整合报org.hibernate.HibernateException: ...... is not valid without active transaction异常
- ssh整合报错org.hibernate.HibernateException: createQuery is not valid without active transaction
- Spring 整合 hibernate 时,抛异常: createQuery is not valid without active transaction
- createQuery is not valid without active transaction异常
- createQuery is not valid without active transaction
- createQuery is not valid without active transaction
- createQuery is not valid without active transaction
- getHibernateFlushMode is not valid without active transaction;
- spring整合hibernate的时候使用session的时候报:is not valid without active transaction
- ssh中如果遇到 xxx is not valid without active transaction
- 解决load,get,save 等is not valid without active transaction异常的原因。
- 解决load,get,save 等is not valid without active transaction异常的原因。
- String格式转换成Data格式
- Linux环境下获取硬盘序列号、型号
- java中volatile关键字的含义
- 第1章 欢迎进入Node.js世界
- java.sql.SQLException: Data truncated for column 'myprice' at row 1
- ssh整合是出现异常: getFlushMode is not valid without active transaction
- Linux,Window之间文件传输-NFS,Samba,SSH
- 美团CODEM 初赛B 景区路线规划 概率DP
- POJ 3468 线段树 解题报告
- CentOS7上 pip install MySQL-python 安装失败(error: command 'gcc' failed with exit status 1)的解决办法
- 苹果捕捉
- 谱聚类算法(Spectral Clustering)
- HDU 1203
- vb.net 教程 4-8 文本文件读写 2