Spring管理Hibernate事务出现异常处理
2013-06-08 12:47
585 查看
出现以下错误:
org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
解决方案:1、判断是否已包含管理
解决方法:
将事务中添加所监听的类
2、是否为SpringMVC+Hibernate架构:
解决办法:
1.如果你将所有控制器(Controller)放在一个包下,配置文件加入:
<context:component-scan base-package="com.web.controllers"/>
2.如所有控制器(Controller)在不同包package下。配置文件加入:
<context:component-scan base-package="com.web" use-default-filters="false">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
解决方案:1、判断是否已包含管理
解决方法:
将事务中添加所监听的类
2、是否为SpringMVC+Hibernate架构:
解决办法:
1.如果你将所有控制器(Controller)放在一个包下,配置文件加入:
<context:component-scan base-package="com.web.controllers"/>
2.如所有控制器(Controller)在不同包package下。配置文件加入:
<context:component-scan base-package="com.web" use-default-filters="false">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
相关文章推荐
- 关于spring声明式事务管理异常处理的测试和小结
- Spring事务管理只对出现运行期异常进行回滚
- Spring事务管理只对出现运行期异常进行回滚
- Spring事务管理只对出现运行期异常进行回滚
- Spring事务管理只对出现运行期异常进行回滚
- spring 管理事务配置时,结果 报错: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here这个异常
- Spring事务管理只对出现运行期异常进行回滚
- Intellij IDEA中Spring配置aop增强事务 出现BeanCreationException异常处理方法
- spring2.0 事务管理以及异常处理之体会
- 关于spring声明式事务管理异常处理的测试和小结
- Spring事务管理只对出现运行期异常进行回滚
- Spring事务管理只对出现运行期异常进行回滚
- Spring事务管理只对出现运行期异常进行回滚
- SPring管理Hibernate事务出现异常处理
- Spring事务管理只对出现运行期异常进行回滚
- spring管理hibernate事务报异常--Transaction not successfully started解决方法
- Spring事务管理只对出现运行期异常进行回滚
- Spring事务管理只对出现运行期异常进行回滚
- Spring事务管理只对出现运行期异常进行回滚
- Spring和Hibernate的结合--声明式事务管理(转)