-->
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.  [ 2 posts ] 
Author Message
 Post subject: Parent object loading
PostPosted: Mon Feb 13, 2006 12:56 pm 
Newbie

Joined: Mon Feb 13, 2006 12:48 pm
Posts: 1
Location: Johannesburg, R.S.A
Hi guys,

Quick question please on a basic 1-many parent/child relationship:

If I do a list on all children, will Hibernate auto load the parent objects in each child?

If so, is there a way that I can tell Hibernate not to load the parents when querying the children?

Or will Hibernate load the parent objects when I call getParent() on the children?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 13, 2006 5:25 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
The default is for lazy initialization. The parent object is loaded when it's needed. If the parent object is already loaded (is in the Hibernate session), then it doesn't have to be loaded again, it's just put in the child object as you'd expect it to be.

The ref docs explain all about lazy initialization.


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