首页 > Web开发 > 详细

Hibernage错误:Could not open Hibernate Session for transaction

时间:2015-01-06 23:07:06      阅读:548      评论:0      收藏:0      [点我收藏+]

今天在做SSH框架整合的时候碰到的这个问题,在测试service层的时候程序正常运行,但是添加Struts,在action层测试的时候提示了如下问题:Could not open Hibernate Session for transaction。大概意思就是数据库连接超时。

解决方法如下:

在spring的配置文件中添加如下配置

给sessionFactory的bean添加如下配置

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  <property name="hibernateProperties">
  <props>
        <prop key="hibernate.autoReconnect">true</prop>
  </props>
  </property>
  </bean>

Hibernage错误:Could not open Hibernate Session for transaction

原文:http://blog.csdn.net/longshengguoji/article/details/42472457

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!