org.hibernate.LazyInitializationException错误的解决办法

来源:互联网 发布:阿里云官方客服电话 编辑:程序博客网 时间:2024/05/21 10:20

org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: org.jbpm.pvm.internal.history.model.HistoryProcessInstanceImpl.historyVariables, no session or session was closed
        at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:380)

 

 

在web.xml中加入以下内容:

<filter>
  <filter-name>openSession</filter-name>
  <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
  <init-param>
   <param-name>singleSession</param-name>
   <param-value>false</param-value>
  </init-param>
 </filter>
 <filter-mapping>
  <filter-name>openSession</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>

原创粉丝点击