title: XML ResultMap in MyBatis with association
body: <p>I see this issue very strange descibed on google or stack. Let me explain. </p>
  
  <p>I have Result Maps in annotations in my interface method. Only in this particular case I need dynamic query, and that is the reason I decided to write the whole mapper for interface in xml file. Below I paste the whole file. The select query should be ok, but I am occuring some difficulties with <code>&lt;resultMap&gt;</code>. </p>
  
  <p>On the different websides I was searching for a good explanation of one to one, one to many, many to one association and construct of this result map in general. </p>
  
  <p>I saw there is some kind of possibility to part it into subqueries, subresultmaps. But I have that already done with myBatis annotations, and I want to use it. 
  Could you direct me, how should the resultMap be constructed? I dont see need for constructor, discriminator, but it is still shouting... (that is why I added <code>&lt;collection&gt;</code> mark) - IntelliJ is underscoring the whole <code>&lt;resultMap&gt;</code>saying: <code>"The content of element type "resultMap" must match "(constructor?,id*,result*,association*,collection*,discriminator?)"</code></p>
  
  <p>I know it seems obvious, but I have completly no idea how to do it correctly. Please help me.</p>
  
  <p>xml mapper file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  
  &lt;!DOCTYPE mapper
          PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"&gt;
  
  &lt;mapper namespace="pl.net.manager.dao.UsageCounterDAO"&gt;
      &lt;select id="getUsageCounterList" resultType="pl.net.manager.domain.UsageCounter"
              resultMap="getUsageCounterListMap"&gt;
          SELECT * FROM usage_counter WHERE
          &lt;if test="apiConsumerIdsList != null"&gt;
              api_consumer IN
              &lt;foreach item="item" index="index" collection="apiConsumerIdsList"
                       open="(" separator="," close=")"&gt;
                  #{item}
              &lt;/foreach&gt;
              AND
          &lt;/if&gt;
          &lt;if test="serviceConsumerIdsList != null"&gt;
              service IN
              &lt;foreach item="item" index="index" collection="serviceConsumerIdsList"
                       open="(" separator="," close=")"&gt;
                  #{item}
              &lt;/foreach&gt;
              AND
          &lt;/if&gt;
          &lt;if test="dateFrom != null"&gt;
              date &amp;gt;= #{dateFrom} AND
          &lt;/if&gt;
          &lt;if test="dateTo != null"&gt;
              date &amp;lt;= #{dateTo} AND
          &lt;/if&gt;
          &lt;if test="status != null"&gt;
              status = #{status}
          &lt;/if&gt;
      &lt;/select&gt;
      &lt;resultMap id="getUsageCounterListMap" type=""&gt;
  
                      ofType="pl.net.manager.domain.UsageCounter"&gt;
              &lt;id property="id" column="id"/&gt;
              &lt;result property="date" column="date"/&gt;
              &lt;result property="apiConsumer" column="api_consumer"
                      javaType="pl.net.manager.domain.ApiConsumer"/&gt;
              &lt;association property="apiConsumer" column="api_consumer"
                           resultMap="pl.net.manager.dao.ApiConsumerDAO.getApiConsumer"/&gt;
              &lt;result property="service" column="service" javaType="pl.net.manager.domain.Service"/&gt;
          &lt;association property="service" column="service"
                       resultMap="pl.net.manager.dao.ServiceDAO.getService"/&gt;
  
              &lt;result property="counterStatus" column="counter_status"/&gt;
              &lt;result property="ratingProcessId" column="rating_process_id"/&gt;
              &lt;result property="value" column="value"/&gt;
              &lt;result property="createdDate" column="created_date"/&gt;
              &lt;result property="modifiedDate" column="modified_date"/&gt;
  
      &lt;/resultMap&gt;
  &lt;/mapper&gt;
  </code></pre>