Spring解决hibernate因session关闭导致的延迟加载例外问题

xiaowanggedege 2011-03-31

只需在web.xml中添加在视图中打开session过滤器,使得session跨越servlet或jsp

<filter>

<filter-name>OpenSessionInViewFilter</filter-name>

<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>

</filter>

<filter-mapping>

<filter-name>OpenSessionInViewFilter</filter-name>

<url-pattern>/*</url-pattern>

</filter-mapping>

相关推荐

LetonLIU / 0评论 2020-05-29