即使在使用spring OpenSessionInViewFilter之后仍然会出现LazyInitializationException

时间:2012-03-23 14:11:28

标签: spring hibernate lazy-initialization

环境:

  • Netbeans 7.1
  • Spring 3.1.1
  • Hibernate 4.0.1
  • JS​​F

我使用org.springframework.orm.hibernate4.support.OpenSessionInViewFilter实现了Spring OpenSessionInViewFilter

但是,我仍然收到错误: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role

我知道正在调用过滤器 - 我可以在堆栈跟踪中看到它。我还需要配置什么? Hibernate配置包括以下内容:

<property name="hibernate.dialect">org.hibernate.dialect.SQLServer2005Dialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="hibernate.current_session_context_class">jta</property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.SunONETransactionManagerLookup</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>

0 个答案:

没有答案