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