-->
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.  [ 1 post ] 
Author Message
 Post subject: Best Practice - Parent Child Relationship of Class w/Itself
PostPosted: Fri Apr 23, 2004 3:09 pm 
Beginner
Beginner

Joined: Wed Dec 03, 2003 2:43 pm
Posts: 22
I have an object MyClass, which has a many to many relationship with itself. Thus it has methods:

public Myclass getParent()

and

public Set getChildren() which returns a Set of MyClass objects.

What is the best practice for loading the entire tree of MyClass objects?

Is it best to set lazy initialization to false for getChildren and run:

"select myclass from MyClass where myclass.parent is nulll"

or can you just run:

"from MyClass"

and trust that the cache of MyClass objects will initialize the sets?

Or is it good practice to run "from MyClass" and somehow initialize the Set objects yourself (esp as these are read only objects)

Or since I am using Oracle is there a way to integrate connect by into my hql to do this?

Or is there a better / simpler way?

Thanks,
Gabe


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.