title: MyBatis Parent Child relation
body: <p>this is my class.. i kept it simple.</p>
  
  <pre><code>public void DummyClass {
     public int id;
     public List&lt;DummyClass&gt; dummyList;
  
     getter / setter...
  }
  </code></pre>
  
  <p>Assume i have a table (DummyTable) with 2 columns id, parentid and i have a number of rows for example:</p>
  
  <p>ID, PARENTID<br>
  1, 1 (the entry is parent)<br>
  2, 1 (the entry has parent with id 1)<br>
  3, 2 (the entry has parent with id 2)<br>
  4, 2 ..<br>
  5, 3 ..<br>
  6, 6 (the entry is parent)<br>
  7, 6 (the entry has parent with 6)<br></p>
  
  <p>can someone tell me how it looks like in mybatis with annotation. i tried it like this:</p>
  
  <pre><code>public interface DummyMapper {
  
   final String SelectAll = "Select * from DummyTable";
   final String SelectDummy = "Select * from DummyTable where parentid = #{id}"; 
  
          @Select(SelectAll)
          @Results({
          @Result(property = "id", column = "id"),
          @Result(property = "dummyList", column = "id", javaType = java.util.List.class, many = @Many(select="getDummyChildren")
          })
          public DummyClass getAllDummies();
  
          @Select(SelectDummy)
          public DummyClass getDummyChildren()
      }
  </code></pre>
  
  <p>someone has a link to a page where it is described how to do this.. or any ideas???</p>