Sowmya, I dont know in what context are you asking? Also have you posted the query in the appropriate forum? But according to my knowledge, Lazy Loading/Fetching is the process of loading the resources on demand irrespective of the type/nature of resources. It depends on the Application Server as well the configuration of the user. You can very well say the App Server to load the resources when it starts. Say for example, in terms of Servlets, you got a tag named <load-on-startup> whose value intimates the level of loading that particular servlet. It should be greater than zero to load the servlet when the application server gets started. I believe the concept (similar to "just in time" or "on demand") will hold good for other contexts too (if you have asked for some other context).
Hope it helps out. Good times ahead, Raghavan alias Saravanan M.
Hmm - Raghavan alias Saravanan Muthu, I think you've missunderstood what Saumya Nair is asking. The question I believe is about the concept of lazy initialization in Hibernate (please correct me if I am wrong Saumya Nair, since you don't mention which ORM you are asking about).
If it is, then this is a technique whereby Hibernate can bring data from the database into its Session only when it is asked for. Consider two tables, one called Person, the other called Address, and a Person has an Address. Suppose you map these in Hibernate to use laze initialization. If you get a Person on its own, will bring back a "proxy" object for the associated Address. In reality, this is little more than the ID of the Address, plus proxy methods. But what it does mean is you can access the associated Address in code without the fear of it being null and Hibernate will go back to the database and populate the Address for you.
When should you use this? Probably all the time. That is unless you have data in two related tables which you know will almost always be accesses together. Suppose you know you'll always need the Address when you get the Person then I wouldn't map this association lazily.
Does this make any sense? [ April 25, 2006: Message edited by: Paul Sturrock ]