论坛首页 入门技术论坛

Hibernate lazy的异常的解决

浏览 2203 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2009-04-24   最后修改:2009-04-25
org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed

在<many-to-one>里,设置成lazy="false".

或则<hibernate-mapping>
    <class lazy="false">

或则在web.xml中加:
<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>*.do </url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>openSessionInViewFilter </filter-name>
<url-pattern>*.jsp </url-pattern>
</filter-mapping>
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics