title: Using mybatis to map multiple tables to a single collection
body: <p>I have the following POJO which I want mybatis to map my database entries to:</p>
  
  <pre><code>public class TestCase {
  
      private List&lt;Filter&gt; filters = new ArrayList&lt;&gt;();
  
  }
  </code></pre>
  
  <p>I have 10 filter implementations, which all implement the <code>Filter</code> interface.</p>
  
  <pre><code>public interface Filter {
      boolean isExcluded();
  }
  </code></pre>
  
  <p>All 10 filter implementations have 10 associated tables. The tables do <strong>not</strong> have the same columns except for the relation to the <code>testcase</code> table. </p>
  
  <pre><code>public class SomeFilter implements Filter {
  
      // Some implementation of Filter
  
  }
  </code></pre>
  
  <p>In the XML mapper I join the 10 tables on the <code>testcase</code> table. I can then use 10 different <code>&lt;resultMap&gt;</code> tags to map each filter to a its respectful field in the <code>TestCase</code> class.</p>
  
  <pre><code>private List&lt;Filter&gt; myFilterA;
  private List&lt;Filter&gt; myFilterB;
  private List&lt;Filter&gt; myFilterC;
  </code></pre>
  
  <p>However, I want to map <strong>all</strong> of them to a <strong>single</strong> field, which is <code>List&lt;Filter&gt; filters</code>. How can I do that?</p>