首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Hibernate lazy的错误的解决

2012-10-31 
Hibernate lazy的异常的解决org.hibernate.LazyInitializationException: could not initialize proxy - t

Hibernate lazy的异常的解决
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>

热点排行