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.
|