ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Heinrich Götzger <goetz...@gmx.de>
Subject Having two N plus 1 groups
Date Wed, 09 Jul 2008 13:33:13 GMT
Hello,

I'm wondering if iBATS help me for solving _two_ N plus 1 problems 
within one select:

Let's assume a result as follows:

   main     group_A   group_b
-------------------------------
   parent1, child_a1, null
   parent1, child_a2, null
   parent1, null,     child_b1
   parent1, null,     child_b2
   parent2, child_a4, null
   parent2, null,     child_b3
   parent3, child_a5, null
   parent3, child_a6, null
   parent3, child_a7, null
   parent3, null,     child_b4

How would I get a list of main-beans with:
- parent1: containing list child_a(a1, a2), list child_b(b1, b2)
- parent2: containing list child_a(a4), list child_b(b3)
- parent3: containing list child_a(a5, a6, a7), list child_b(b4)

Group a and group b are not related to each other. They are only related 
to parent

A more convenient solution could be the usage of collection types in the 
result set. This would lead to a collection of group a and one of group 
b. The resulting main-beans would be the same.
Is there some support in iBATIS for collection types?


Thanks for some thoughts and some help.

Cheers

Heinrich

Mime
View raw message