No Hibernate Session bound to thread, and configuration does not allow
2014-11-24 22:27
477 查看
今天晚上挺悲催的,遇到了这个问题花费我很长时间,现在总结如下:
到这这种情况的发生有两种情况:
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,也就无从谈起事务了。
到这这种情况的发生有两种情况:
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 boundNo Hibernate Session bound to thread, and configuration does not allow cr
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactiona
- 三大框架整合异常之No Hibernate Session bound to thread, and configuration does not allow creation of non-tran
- No Hibernate Session bound to thread, and configuration does not allow
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional
- hibernate错误提示: No Hibernate Session bound to thread, and configuration does not allow creation of no
- No Hibernate Session bound to thread, and configuration does not allow
- spring 管理事务配置时,结果 报错: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here这个异常
- 继承类的@Transactional:org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow crea
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional
- No Hibernate Session bound to thread, and configuration does not allow creation
- HibernateError:No Hibernate Session bound to thread, and configuration does not allow creation of
- HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation
- No Hibernate Session bound to thread, and configuration does not allow create解决方案
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactiona
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional
- No Hibernate Session bound to thread, and configuration does not allow creat
- No Hibernate Session bound to thread, and configuration does not allow creat
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional