Where did you get the data you used to print below?
If it is from the same 'event' object instance returned by hibernate, and if at that moment that object is still managed by hibernate, you will inadvertently load the data.
appreciate for your quick response, even i removed toString() in all classes still able to see
in debug view the event object and its all child objects loaded with all values set.
So i am sure that returned session.get() which is event is loaded all its child objects.
This means eclipse debug view loading all referenced child objects?
Yes, it is possible that is the eclipse debug mode that loads it.
Quite dirty, but just to see that those data are really lazily-loaded: disable the debug mode of eclipse, after getting the 'event' object from hibernate, terminate or close the hibernate session, then try display the supposed-to-be lazily-loaded data. You should get an exception or null, showing that it was never loaded by hibernate.
you are right!!!
after session closed in eclipse debug mode i can see message about all referenced objects
as "com.sun.jdi.InvocationException occurred invoking method", means referenced data not loaded.
i never expected that eclipse debug mode causing referenced data get loaded by parent.
bacon. tiny ad:
Gift giving made easy with the permaculture playing cards