Junilu Lacar wrote:My first, gut-wrench reaction was ... EJB? Yuck
Do you have good reasons to use EJB?
I've dealt with this type of relationship before but I used Spring and POJOs. Basically, the DAO will get individual nodes, which I have Spring DAOSupport read from the DB and turn into a Map for me. Then I iterate through the Map elements and build up the Tree. I remember having to do a build and collect. Collect because as you iterate through the map, you can run across child nodes whose parent nodes have not been processed yet so you have to go through the whole list once to create as many trees as you can, possibly ending up with a few trees with temporarily orphaned "root" nodes. Then you go through all the "root" nodes of these small trees and reunite them with their parents, which should be somewhere in one of the other trees. The only "root" node where this reuniting process fails is the actual root node of the final single-view tree.
Hope this helps
Tongue wrestling. It's not what you think. And here, take this tiny ad. You'll need it.
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
|