您的位置:首页 > 编程语言 > Java开发

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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: