Which I could do with a join on SQL side. I can't see how this is something I'd use or how it' scale, but.... I guess somone uses it.
THANKS for the education.
.V


Kris Jenkins wrote:



The N+1 selects problem is when you query for n parents, and you need one extra query for the children. Internally, this happens:

   List parents = sqlMap.queryForList( "getParents", parameter );
   for ( Iterator i = parents.iterator(); i.hasNext(); ) {
      Parent p = (Parent) i.next();
      List children = sqlMap.queryForList( "getChild", p.getId() );
      p.setChildren( children );
   }

So you end up with 1 query for the parent list, plus one extra for each parent to get the children = n + 1. Rather inefficient.
This is the problem that 2.0.9 fixes.


Sorry for the confusion.
Kris



--
Forums, Boards, Blogs and News in RiA <http://www.boardVU.com>

Reply via email to