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-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org

Reply via email to