nested set
http://www.developer.com/db/article.php/3517366
materialized path
http://philihp.blogspot.com/2008/05/usi ... trees.html
So i've been reading about these two patterns for optimized tree persistence in a relational DB and i think i'm starting to understand how they work but i have a question...
If i were to implement one of them it would give me a quick way of selecting all of the sub nodes of any location in the hierarchy. But! How do i convince hibernate to organize the instantiated objects as a tree.
What happens is i get a flat list of all of the nodes and if you touch one of the children it queries the DB to load them. Just for the heck of it i tried to manually stuff one of the children into it's parent programatically but that didnt resolve the issue. (it still queried the DB but now i had a duplicate instance of the child object)