| 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
|
 |
 |
|
|
subject: How does Hibernate get child objects
|
|
|