hibernate 问题集

1、Could not obtain transaction-synchronized Session for current thread

解决方法:

在web.xml中加入如下配置:

 <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>
原文地址:https://www.cnblogs.com/tyb1222/p/4241754.html