2 Replies Latest reply on Jun 19, 2006 6:55 AM by lcoetzee

    Eager loading now the default on collections ?

    lcoetzee

      Hi,

      I upgraded my environment to EJB3-RC8 and the latest seam version from CVS (1.0.1GA). Something very weird appears to happen. For some reason my collections are not lazy initialized anymore (I get a lot of sql statements in my log file with stuff like " [org.hibernate.engine.StatefulPersistenceContext] initializing non-lazy collections").

      Has the loading changed from Lazy to Eager ?

      Regards

      Louis

        • 1. Re: Eager loading now the default on collections ?
          gavin.king

          The default should certainly not have changed, since that is defined by the spec ;-)

          Ask in the EJB3 forum, I have not noticed any change in behavior, and I don't think Emmanuel is monitoring this forum closely.

          • 2. Re: Eager loading now the default on collections ?
            lcoetzee

            I have investigated quite a bit more. The defaults are still Lazy. My problem was related to a toString method in my entity that recursively called all the other entities attached to it (e.g. the many-to-many and one-to-many).

            Somewhere this toString was called, resulting in my whole database being eagerly loaded. I cant figure out where it is called (I think in one of the Tomahawk components .. as I have also changed to the latest tomahawk 1.1.3) . However, it was a bad idea to abuse toString in such a way (initially it was a good way just to check on the structure and content in one call, but I should have fixed it some time ago).

            Thanks for the feedback.

            Later

            Louis