-->
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: what is lazy loading?
PostPosted: Wed Nov 05, 2008 4:36 am 
Newbie

Joined: Fri Oct 31, 2008 11:53 pm
Posts: 3
what is lazy loading?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 05, 2008 5:45 am 
Newbie

Joined: Wed Nov 05, 2008 5:44 am
Posts: 1
http://en.wikipedia.org/wiki/Lazy_loading

Just read it, its simple


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 05, 2008 6:00 am 
Newbie

Joined: Sat Oct 18, 2008 11:34 am
Posts: 10
In a nutshell: when an object (e.g. "User" containing basic info about username, account status) contains a reference to another object that is not always needed (e.g. UserProfile containing stuff like biography, birthplace etc.), the lazy loading helps you to save the resources in a way that it loads the object from the database only when referenced. Lazy loading is handled by Hibernate in a transparent, automatic way, so you theoretically don't have to take much care about it..

In other words, without lazy loading, fetching just one object could result in loading the entire database, and that's very bad.

Read the article, it is basically simple, but has a *lot* of gotchas and requires reading and experimenting.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 05, 2008 8:48 am 
Regular
Regular

Joined: Wed Oct 15, 2008 6:59 am
Posts: 103
Location: Chennai
Defer initialization of an object until the point at which it is needed. It can contribute to efficiency in the program's operation if properly and appropriately used. The opposite of lazy loading is Eager Loading.

For example when we query Users class...

from Users u; --retrieve users objects

May users object has refer some other objects like Profile, Messages etc.,
When we run the above query it only get Users object from table. When we refer Profile object that time only it loads Profile object from table. that technique is lazy loading. due to that it require only small time and space.

_________________
If u feel it will help you, don't forget to rate me....


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.