hibernate 問題集

一、Could not obtain transaction-synchronized Session for current threadweb

解決方法:spring

在web.xml中加入以下配置:app

 <filter>
        <filter-name>SpringOpenSessionInViewFilter</filter-name>
        <filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>SpringOpenSessionInViewFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
相關文章
相關標籤/搜索