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 How does Hibernate get child objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How does Hibernate get child objects" Watch "How does Hibernate get child objects" New topic
Author

How does Hibernate get child objects

Himadri Das
Greenhorn

Joined: Nov 05, 2007
Posts: 2
Hi , I have very recently started using Hibernate JPA and have some basic doubts.

How does hibernate get child records . This is my understanding , please correct me if am wrong.

For Eg , parent has two child . if I query parent , I get the childs also if fetchType = Eager. Its true for vice versa also.

Suppose , the query comes from child , child 1 to get its parent. and another child 2 has also requested the same parent. During loading of child 2 queried , will hibernate created an object of parent in memory or use the one already loaded by child 1 ?

What is lazy loading ?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


For Eg , parent has two child . if I query parent , I get the childs also if fetchType = Eager. Its true for vice versa also.

Yes.

lazy loading is the behaviour whereby associated objects are loaded only when they are requested. The trigger to load the associated object is asking for a property of the associated object from the parent, e.g.:

[ June 03, 2008: Message edited by: Paul Sturrock ]

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How does Hibernate get child objects