-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Lazy?
PostPosted: Fri May 14, 2004 1:28 pm 
Regular
Regular

Joined: Thu Apr 15, 2004 1:12 pm
Posts: 55
This is a way noob question, but... I couldn't figure it out from the manual...

I have a <class ... lazy="true">. What exactly are the semantics of this? I gather that it causes something(s) to happen lazily, i.e. demand-driven (but by what, exactly?), which otherwise would happen eagerly, i.e. at load() time, but that's as far as my understanding goes.

Does the whole object get reconstituted at once, say, when an accessor is first called for any of its properties? Or is a separate SQL query made for each property if and when that property's accessor is called?

When is it safe to close() the session in which a lazy object was loaded?

Thanks,
~ mark


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 14, 2004 1:35 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
The whole object gets loaded at once as soon as it is first accessed. You can close the session after it is loaded, or anytime if you don't plan to access the object anymore.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 14, 2004 1:38 pm 
Regular
Regular

Joined: Thu Apr 15, 2004 1:12 pm
Posts: 55
Thanks for the quick reply, Michael:
:-)
~ mark


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 17, 2004 5:12 am 
Senior
Senior

Joined: Sun Mar 14, 2004 10:16 am
Posts: 129
Location: Ankara
but you must remember that you need to keep session open until it is completely loaded. You load the object lazily but u need the transfer the session from classes to classes until you load the complete object.
As In the object oriented world, we have the good chance not to do everything in one class. "Create session, execute query, load object, load lazily loaded part and close the session". Here where is the advance of the lazy loading.?

I mean,In my opinion, if u load lazily not so much data, dont load it lazily or else you must handle the session management and concurency chaos for many accesses at the same time.
That breaks the complete efficient use of lazy loading.

I believe hibernate could and should handle the session management behind the codes. (At least for lazy loading-:)) Then I call it complete efficient great lazy loading.

_________________
-developer


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.