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 Tue, 23 Feb 2010 03:59:00 GMT
On 2/22/2010 2:35 AM, Jakub Vondrak wrote:

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

Ok, this works:

<resultMap id="BillItemNestedMap" type="com.ibatisdemo.db.Bill" >
     <id column="bill_id" property="id" jdbcType="INTEGER" />
     <collection column="bi_item_order" property="billItems" 
javaType="ArrayList" ofType="com.ibatisdemo.db.BillItem">
        <id column="bill_id" property="idBill" jdbcType="INTEGER" />
        <id column="bi_item_order" property="itemOrder" 
jdbcType="INTEGER" />
        <result column="bi_sku" property="sku" jdbcType="VARCHAR" />
        <result column="bi_name" property="name" jdbcType="VARCHAR" />
        <association column="bi_item_order" property="billItemKey" 
javaType="com.ibatisdemo.db.BillItemKey">
           <id column="bill_id" property="idBill"/>
           <id column="bi_item_order" property="itemOrder" />
        </association>
     </collection>
</resultMap>


The two columns from BillItemKey are also in BillItem because I used 
Ibator to generate the classes.

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