title: MyBatis ResultMap Collection - Returning only one row
body: <p>I'm having a bit of trouble with a one-to-many relationship in MyBatis. I have a User in my DB who can have many Addresses. The User and Address tables are linked using an id. However MyBatis only populates the first address. The weird thing is when I run the mySQL code separately it works fine, so I'm guessing it has something to do with my MyBatis mappings. </p>
  
  <pre><code>&lt;select id="fetchUserAddressList" parameterType="string" resultMap="userAddressResultMap"&gt;
      SELECT user.user_name, address.id, address.address_value
      FROM user 
      LEFT OUTER JOIN address
      ON user.id = address.id 
      WHERE user.id = #{userId}
  &lt;/select&gt;
  
  &lt;resultMap id="userAddressResultMap" type="com.bean.User" &gt;
      &lt;id property="userName" column="user_name" /&gt;
  
      &lt;collection property="addressList" column="id" notNullColumn="id"
                  ofType="com.bean.Address"
                  resultMap="addressResultMap" /&gt;
  &lt;/resultMap&gt;
  
  &lt;resultMap id="addressResultMap" type="com.bean.AddressBean" &gt;
      &lt;id property="userId" column="id" /&gt;
      &lt;result property="userAddress" column="address_value" /&gt;
  &lt;/resultMap&gt;
  </code></pre>
  
  <p>Anyone got any ideas?</p>