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
|
|