All,

using groupBy, we can construct an object which contains a list of objects, for example,

 <resultMap id="MemberCoupon" class="MemberCoupon" groupBy="couponId">
    <result column="coupon_id" property="couponId" jdbcType="INTEGER"/>
    <result property="savingCardStatuses" resultMap="savingCardStatusMap" />
  </resultMap>

  <resultMap id="savingCardStatusMap" class="SavingCardStatus" >
          <result property="SavingCardId" column="card_id" jdbcType="SMALLINT"/>
          <result property="couponStatusId" column="status_id" jdbcType="SMALLINT"/>
  </resultMap>

Is there any way that I can put card_id and status_id in Map so that the final object will comtain a Map, not a list of Maps?

If  a couponId has three saving cards, the Map will have three cardIds and their corresponding status_id.

Thanks,
Tony

Reply via email to