I would think that a more efficient SQL tree query would be much better for this case. That way you get exactly what your looking for then you can return the objects back that you need rather then looping though all or most of the tree structure in Java.

Read the book by Joe Celko on Tree algorithms for some great info on how to deal with this.



Regards,
Brian Hurley
secret...@javmug.org
Leader Spring Dallas User Group




-------- Original Message  --------
Subject: Re: what happened to queryForMap?
From: Rick R <ric...@gmail.com>
To: user-java@ibatis.apache.org
Date: 03/19/2010 19:52
On Fri, Mar 19, 2010 at 8:08 PM, Clinton Begin <clinton.be...@gmail.com <mailto:clinton.be...@gmail.com>> wrote:

    It was liquidated. Honestly I thought it was messy... but maybe I
    underestimated its usefulness...


Well, most times I'm using it are for when I have a nested structure defined defined by a parentID column in the same table and you can have n umber of nodes in your tree. I get too lazy trying to figure out how to get an ibatis map populated n-levels deep of nested nodes, so I typically just return a map of all values... key: id, value: thObject.

Then I just go and manually iterate over the values of the map and add if it has a parentID I find the parent in the map by id and then it as child to the parent. Seem to work pretty well, but maybe there's a more efficient way to build up a tree?


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org

Reply via email to