No Hibernate Session bound to thread, and configuration does not allow
今天晚上挺悲催的,遇到了这个问题花费我很长时间,现在总结如下:
到这这种情况的发生有两种情况:
1,没有配置事物只要在Spring配置文件中添加如下代码:
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<tx:annotation-driven transaction-manager="txManager"/>
然后在DAO程序前面加上@Transactional即可。
2,连接数据的配置是否正确,如果连接字符串不正确的话,就不能够创建SessionFactory,也就无从谈起事务了。
No Hibernate Session bound to thread, and configuration does not allow的更多相关文章
- org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not a ...
- spring事务管理出错。No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy ...
- No Hibernate Session bound to thread, and configuration does not allow creat
No Hibernate Session bound to thread, and configuration does not allow creat 今天遇到这么一个错误,在网上差了很多都没有能解 ...
- spring 管理事务配置时,结果 报错: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here这个异常
java.lang.IllegalStateException: No Hibernate Session bound to thread, and configuration does not al ...
- 解决No Hibernate Session bound to thread, and configuration does not allow creat。。。
applicationContext.xml配置 <?xml version="1.0" encoding="UTF-8"?> <beans ...
- 出现No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here异常
问题描述: public void save(BaseEntity baseEntity) { Session session = null; try { session = currentSessi ...
- org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not a
如果出现了这个错误,看看在使用Hibernate的时候有没有在事务的环境下执行操作!
- 报错解决:No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
大概分析一般使用了注解才会报这方面的错 1.没有在spring的ApplicationContext.xml中开启注解事务 <!-- 开启注解事务 --> <tx:annotatio ...
- org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not
遇到这个问题之前,我去百度和谷歌去搜索了一下.发现各种说法.可是针对我的项目而言,也就是公司的项目而言,这个问题的根源并不是是网上所说的那样. 最后是通过自己的想法做測试得到了解决. 1.首先说说我的 ...
随机推荐
- linux 学习笔记3
①find -name *.txt //查看当前目录所有文件 .txt 结尾文件 ②whereis *.txt //查看.txt结尾文件 但不显示 .txt 打包:tar -cf a.tar ...
- Spark Streaming揭秘 Day30 集群模式下SparkStreaming日志分析
Spark Streaming揭秘 Day30 集群模式下SparkStreaming日志分析 今天通过集群运行模式观察.研究和透彻的刨析SparkStreaming的日志和web监控台. Day28 ...
- thinkphp 使用过程中遇到的一个小函数
1.实现导出Excel文件,并在导出的文件中显示图片 //导出 public function push(){ $goods_list=M('Dajia')->select(); $data = ...
- [旧博客]Python 第一天总结
语法部分: 3**4 表示3的四次方 -1**3 结果是-1 raw_input 输入文本 input 输入值,input 3*3 结果为9 pow(5,5) 等于 5*5 abs(-1.8) 等于 ...
- sp_depends 查询在sybase中依赖的函数
sp_depends 查询在sybase中依赖的函数. sp_depends tblEK7_policy_exclude sp_depends tblEK7_agent_exclude
- 泛形集合List<T>
public class Person { /// <summary> /// 姓名 /// </summary> private string name; public st ...
- [转载]MongoDB优化的几点原则
.查询优化 确认你的查询是否充分利用到了索引,用explain命令查看一下查询执行的情况,添加必要的索引,避免扫表操作. .搞清你的热数据大小 可能你的数据集非常大,但是这并不那么重要,重要的是你的热 ...
- The 7th Zhejiang Provincial Collegiate Programming Contest->Problem B:B - Somali Pirates
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3323 题意:去掉字符串里面的数字然后按输入顺序输出 #include< ...
- uva 1377
比较不错的一个题,关键是理解状态转移 #include<algorithm> #include<cstdio> #include<cstring> #include ...
- uva 10056
概率 Q += p*pow(1-p, i*n+k-1) i = 0,1,2,3...... #include <cstdio> #include <cmath> int mai ...