I knew I was missing something simple ... doh! :)
Michal Malecki wrote:
Well, I think you need only simple join in your sql, no extra features of
ibatis needed:
select * from CHILD, PARENT where parent_id=PARENT.id;
am I right?
Michal Malecki
What about relationships from the child up to the parent? Are they also
classified as N+1?
Suppose we have child table with a fk of parent_id.
if I do:
SELECT * from CHILD
I'll get a column with parent_id with values.
Now suppose I also want details pertaining to the parent_id along with
the recordset of Child, I need not
do 10 separate selects for the parent ... is this also an N+1 problem?
What is the preferred iBatis model for this?
Cheers
Abdullah
Kris Jenkins wrote:
friendVU admin wrote:
What is n+1?
.V
n++! :-P
It's when each child object in a complex query has to be selected
seperately. If 'parent' has 10 'children', you end up with 10+1
select statements being issued. See the developer's guide under
'Avoiding N+1 selects' for the full lowdown. Version 2.0.9 comes with
new groupBy goodness to banish the N+1 problem.
Kris