-->
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.  [ 3 posts ] 
Author Message
 Post subject: Problem in understanding Lazy fetching.
PostPosted: Mon May 26, 2008 5:45 am 
Newbie

Joined: Wed Mar 12, 2008 11:16 am
Posts: 15
Hi Experts

I m new to hibernate and i need to develop on application in hibernate.
I did not understand the Lazy fetching.Can any one
Plz Plz Plz Plz Plz Plz Plz Plz give me an example where exactly lazy fectching comes in to play.I will be thankful if u give the complete code.
Plz explain me a senario where lazy fetching is used.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 26, 2008 12:56 pm 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Lazy loading just means that data isn't loaded until it is needed. Say a doctor has 5000 patients. If you want information about the doctor, like his name and phone number, should the application also load all 5000 patient records? Of course not. So, while there is an association, you want that association loaded in a lazy fashion, so your database doesn't come to a crawl. However, with lazy loading, when one of those patient records is needed, it will be loaded, but only that one record.

Here are a variety of free tutorials and Hibernate example code for you to go through. There are lots of complete Hibernate and JPA code examples that you ask for:


http://www.hiberbook.com/HiberBookWeb/learn.jsp?tutorial=17mappingonetooneassociations

Lazy loading really becomes applicable when you have objects that are associated with each other, so you might want to look at the sections on mapping associations with Hibernate and JPA.

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject: Thanks McKenzie
PostPosted: Mon May 26, 2008 11:50 pm 
Newbie

Joined: Wed Mar 12, 2008 11:16 am
Posts: 15
Thnks for ur explanation.Nice to get a reply from a spectaculra expert.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.