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?

Well, that's the right query, but only if you use groupBy. Assuming you're trying to get Parent objects populated with their correct Child objects, you query will return something like:

parent_id | child_id
----------+---------
1         | a
1         | b
1         | c
2         | d

Without groupBy in your resultMap, you'll end up with 3 parent objects, each with one child. What you wanted was 2 parents, one with three children.

So you're right, groupBy allows you to do this with one query, but before v2.0.9 you'd've needed two separate ones to get the right result.

Kris

--
Kris Jenkins
Email:  [EMAIL PROTECTED]
Blog:   http://cafe.jenkster.com/
Wiki:   http://wiki.jenkster.com/





Reply via email to