0 Replies Latest reply on Sep 6, 2006 7:42 AM by Gregor Graf

    LazyInitializationException with Spring/Hibernate

    Gregor Graf Newbie

      Hi!

      After setting up all my hibernate mappings I can't get rid of the following exception:

      ERROR [LazyInitializationException] could not initialize proxy - the owning Session was closed
      org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
      at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:60)
      at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:102)
      at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:160)
      at .......bo.AppointmentBO$$EnhancerByCGLIB$$b3086c3e_4.toString()
      ....................

      The application is able to fetch the records from the database but as soon as I try to iterate over the PersistentSet it throws the exception stated above.

      I read on the Internet that I should use org.springframework.aop.framework.ProxyFactoryBean which takes care of HibernateSession handling.

      My *.hbm.xml files do not contain lazy="true" tags. Can someone help me out?

      Your help will be greatly appreciated!