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

session 关闭有关问题

2012-11-19 
session 关闭问题[ERROR,LazyInitializationException,http-8080-1] failed to lazily initialize a colle

session 关闭问题
[ERROR,LazyInitializationException,http-8080-1] failed to lazily initialize a collection of role: com.goodwill.basic.entity.Person.cardList, no session or session was closed
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.goodwill.basic.entity.Person.cardList, no session or session was closed
在web.xml中加入下列配置
<!-- 保证session不会关闭-->
<filter>
    <filter-name>openSessionInViewFilter</filter-name>
    <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
    <init-param>
            <param-name>singleSession</param-name>
            <param-value>true</param-value>
    </init-param>
    <init-param>
            <param-name>sessionFactoryBeanName</param-name>
            <param-value>sessionFactory</param-value>
    </init-param>
</filter>
<filter-mapping>
<filter-name>openSessionInViewFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
   

热点排行