I can't seem to get this to work. I will try to explain a full example here.
Imagine the following data structure:
-ObjectA has a List of ObjectB's (1:M)
-ObjectB has a variable ObjectC (1:1)
-Object C has three children lists (Child1, Child2, Child3 - all 1:M)
The SQL looks something like (postgresql syntax)
SELECT a.object_a_id, b.object_b_id, c.object_c_id
FROM object_a a
JOIN object_b b USING (object_a_id)
JOIN object_c c USING (object_b_id)
JOIN child_1 c1 USING (object_c_id)
JOIN child_2 c2 USING (object_c_id)
JOIN child_3 c3 USING (object_c_id)
This SQL would obviously return multiple rows with duplicate data.
Assuming there was 2 rows for each of the three children you would get
8 rows for each ObjectC
child_1_id | child_2_id | child_3_id
1 | 1 | 1
2 | 1 | 1
1 | 2 | 1
2 | 2 | 1
1 | 1 | 2
2 | 1 | 2
1 | 2 | 2
2 | 2 | 2
Now in iBatis I would like to get a result of one ObjectC that has a
List of 2 objects for each of the children. The result I am getting
is 2 objects for the Child1 List, 4 objects for the Child2 List, and 8
objects for the Child3 List.
Is this example clear enough? I suppose I can do a code example if required.
Another strange thing I have found is that iBatis does not complain if
the groupBy uses a meaningless string. Meaning I can have
groupBy="foo" and I do not get any errors ('foo' is not a column in
the table or POJO. Is this behavior to be expected?
Regards,
Collin