title: iBatis how to solve a more complex N+1 problem
body: <p>I have a database that is similar to the following:</p>
  
  <pre><code>create table Store(storeId)
  create table Staff(storeId_fk, staff_id, staffName)
  create table Item(storeId_fk, itme_id, itemName)
  </code></pre>
  
  <p>The Store table is large.</p>
  
  <p>And I have create the following java bean</p>
  
  <pre><code>public class Store
  {
      List&lt;Staff&gt; myStaff
      List&lt;Item&gt; myItem
  
     ....
  }
  
  public class Staff
  {
      ...
  }
  
  public class Item
  {
     ...
  }
  </code></pre>
  
  <p>My question is how can I use iBatis's result map to EFFICIENTLY map from the tables to the java object? </p>
  
  <p>I tried:</p>
  
  <pre><code>&lt;resultMap id="storemap" class="my.example.Store"&gt;
    &lt;result property="myStaff" resultMap="staffMap"/&gt;
    &lt;result property="myItem" result="itemMap"/&gt;
  &lt;/resultMap&gt;
  
  (other maps omitted)
  </code></pre>
  
  <p>But it's way too slow since the Store table is VERY VERY large.</p>
  
  <p>I tried to follow the example in Clinton's developer guide for the N+1 solution, but I cannot warp my mind around how to use the "groupBy" for an object with 2 list...</p>
  
  <p>Any help is appreciated!</p>