title: Select query in MyBatis using resultMap fetches only one row
body: <p>We are using MyBatis for one of the projects I am working on. I am facing a problem while trying to fetch results using a resultMap. </p>
  
  <p><strong>mapper.xml</strong>   </p>
  
  <pre><code> &lt;resultMap id="BaseResultMap" type="com.mycompany.myproduct.dto.ChannelMap"&gt;
          &lt;id column="CHNL_MAP_ID" property="chnlMapId" jdbcType="DECIMAL" /&gt;
          &lt;result column="CHNL_MAP_NM" property="chnlMapNm" jdbcType="VARCHAR" /&gt;
          &lt;association property="ctnDlvryPltf"
              resultMap="com.mycompany.myproduct.mapper.ContentDelvryPltfrmMapper.BaseResultMap" /&gt;
          &lt;association property="ctnDtr"
              resultMap="com.mycompany.myproduct.mapper.ContentDistributorMapper.BaseResultMap" /&gt;
          &lt;association property="region"
              resultMap="com.mycompany.myproduct.mapper.RegionMapper.BaseResultMap" /&gt;
      &lt;/resultMap&gt;    
      &lt;sql id="Value_Columns_List"&gt;
          cmap.CHNL_MAP_NM, cdp.CTN_DLVRY_PLTF_NM,
          cdp.CTN_DLVRY_PLTF_TYP_NM, cdp.CTN_DTR_NM, cd.CTN_DTR_NM,
          cmap.RGN_ID, cmap.CNTRY_ID
      &lt;/sql&gt;
      &lt;select id="select" resultMap="BaseResultMap"&gt;
          select
          &lt;include refid="Value_Columns_List" /&gt;
          FROM
          channel_map cmap,
          (SELECT
          cdpl.ctn_dlvry_pltf_id,cdpl.ctn_dlvry_pltf_nm,
          cdplt.ctn_dlvry_pltf_typ_nm ,cds.ctn_dtr_nm FROM
          content_delvry_pltfrm
          cdpl,
          content_delvry_pltfrm_typ cdplt,
          content_distributor cds
          WHERE
          cdpl.ctn_dlvry_pltf_typ_id =
          cdplt.ctn_dlvry_pltf_typ_id AND
          cdpl.ctn_dtr_id = cds.ctn_dtr_id)
          cdp,
          content_distributor
          cd
          WHERE
          cmap.ctn_dlvry_pltf_id = cdp.ctn_dlvry_pltf_id AND
          cmap.ctn_dtr_id = cd.ctn_dtr_id         
      &lt;/select&gt;
  </code></pre>
  
  <p>The important things to note in the above file is that we are fetching the column named CTN_DTR_NM twice in the select query through a different alias (See Value_Columns_List) . This is because the channel_map table contains a CTN_DTR_NM. The channel map table also contains a reference to another table which contains a CTN_DTR_NM. </p>
  
  <p>The problem I am facing is that even though the channel_map table contains multiple rows, the select method returns a List that contains only one row. Checking the MyBatis logs shows that the actual query fetched multiple rows and all the fetched rows are displayed in the logs. I have a feeling the problem has got something to do with the way the result set fetched by MyBatis is being mapped against my POJOs.</p>