java

位置:IT落伍者 >> java >> 浏览文章

SPring管理Hibernate事务出现异常处理


发布日期:2021年12月04日
 
SPring管理Hibernate事务出现异常处理

[html]

出现以下错误

orghibernateHibernateException: No Hibernate Session bound to thread and configuration does not allow creation of nontransactional one here

解决方案判断是否已包含管理

解决方法

将事务中添加所监听的类

是否为SpringMVC+Hibernate架构

解决办法

如果你将所有控制器放在一个包下配置文件加入

<context:componentscan basepackage=ntrollers/>

如Controller Service DAO在不同包package下配置文件加入

<context:componentscan basepackage=comweb usedefaultfilters=false>

<context:includefilter type=annotation expression=orgspringframeworkstereotypeController/>

</context:componentscan>

               

上一篇:进行Struts应用程序单元测试开发

下一篇:hibernate连接查询总结