Spring framework3.2整合hibernate4.1报错:No Session found for current thread

解决办法 在项目web.xml中配置

 

 <!-- openSessionInView配置 -->

    <filter>
        <filter-name>openSessionInViewFilter</filter-name>
        <filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
        <init-param>
            <param-name>singleSession</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>openSessionInViewFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

 

posted @ 2015-10-30 10:28  birkhoff001  阅读(137)  评论(0编辑  收藏  举报