Hibernate4与spring3 sessionFactory().getCurrentSession() 空指针

来源:互联网 发布:mysql case when 编辑:程序博客网 时间:2024/06/03 18:35

在web.xml中配置

<filter>          <filter-name>hibernateFilter</filter-name>          <filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>          <init-param>             <param-name>sessionFactoryBeanName</param-name>             <param-value>sessionFactory</param-value>                   </init-param>             </filter>    <filter-mapping>        <filter-name>hibernateFilter</filter-name>        <url-pattern>/*</url-pattern>    </filter-mapping>

SessionFactory().openSession()会一直占用数据库连接不释放

http://stackoverflow.com/questions/15939932/hibernateexception-no-session-found-for-current-thread-when-calling-service-from

http://docs.spring.io/spring/docs/3.1.x/javadoc-api/org/springframework/orm/hibernate4/support/OpenSessionInViewFilter.html

0 0
原创粉丝点击