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>

 

你可能感兴趣的:(Spring framework3.2整合hibernate4.1报错:No Session found for current thread)