File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes fetching.lazy Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "fetching.lazy" Watch "fetching.lazy" New topic
Author

fetching.lazy

Vinoth kumar Gajapathy
Greenhorn

Joined: Oct 05, 2007
Posts: 16
i am new to hibernate can any one tell me why we using fetching.lazy in database coding side(on onetomany,etc) and what is purpose of this and is any other type ? explain please
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4967

There is both eager and lazy fetching.

Basically, an object can be associated with many other objects. At runtime, you may not need to know about all of the associated objects. Say you have a User with ten addresses. If you want to know the user's name, should you do all the database calls to get the 10 addresses as well? Definitely NOT. So, we make associations lazy, and as such, associated classes do not get populated with real data until that real data is needed. It's very efficient, and often very preferrable. I also believe it is the default with all but one-to-one associations.

-Cameron McKenzie


Author of Hibernate Made Easy, What is WebSphere???, JSF 2.0 Made Easy and the SCJA Certification Guides
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: fetching.lazy
 
Similar Threads
[eclipse] any good .html plugin that you recommend?
unable to add App Project into testServer
Unadulterated petrol pumps in bangalore
Page implicit Object?
Suggestions for team cheer