ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakub Vondrak <i...@centrum.cz>
Subject Re: performance issue for id as association
Date Mon, 22 Feb 2010 07:35:27 GMT
Guy Rouillier wrote:
> 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.
> 
Yes it is unnecessary for iBatis. The reason why this class exists is
that the model was created to suite Hibernate several years ago.

I'm trying to convert data layer to iBatis and retain a compatible
model. Then I would like to compare performance and ease of use.

---------------------------------------------------------------------
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