ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guy Rouillier <guyr-...@burntmail.com>
Subject Re: performance issue for id as association
Date Mon, 22 Feb 2010 06:21:20 GMT
On 2/21/2010 6:15 AM, Jakub Vondrak wrote:

>>>      <resultMap id="billResultMap" type="Bill">
>>>         <id column="bill_id" property="id" />
>>>         <collection property="billItems" ofType="BillItem">
>>>             <result column="bi_sku" property="customId" />
>>>             <result column="bi_name" property="name" />
>>>             ...
>>>
>>>            <association property="id" javaType="BillItemId">
>>>               <id column="bill_id" property="idBill"/>
>>>               <id column="bill_id" property="itemOrder" />
>>>            </association>
>>>         </collection>
>>>      </resultMap>

> What I guess is the problem is that I cannot express *composite key as
> an BillItemId object* on the BillItem class and I guess I will need own
> TypeHandler for whole Bill class.

This works for me:

<resultMap id="billResultMap" type="Bill">
    <id column="bill_id" property="id" />
    <collection property="billItems" javaType="ArrayList" ofType="BillItem">
        <id column="bill_id" property="idBill"/>
        <id column="bi_item_order" property="itemOrder" />
        <result column="bi_sku" property="customId" />
        <result column="bi_name" property="name" />
        ...

    </collection>
</resultMap>

The separate BillItemId class is unnecessary.

-- 
Guy Rouillier

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message