Well, I think this map should go in OrderItem.xml file? or it doen't matter?
Thank man.



Hemant.Kamatgi wrote:
> 
> The resultmap shown below can be used for M:1 relationship also.
> For eg:
>> <resultMap name="OrderItemMap" class="OrderItems">
>> 
>>      <result property="id" column="ORDER_ITEM_I" />
>       <result property="order" resultMap="order.OrderMap" />
>>      .....
>> </resultMap>
> 
> This shud work, I guess.
> 
> Regards
> Hemant
> 
> 
> 
> 
> -----Original Message-----
> From: HHB [mailto:[EMAIL PROTECTED] 
> Sent: Monday, July 30, 2007 5:45 PM
> To: [email protected]
> Subject: RE: Basic mapping in iBatis
> 
> 
> Thank you Hemant.
> You showed me how to map the relation from Order to OrderItem.
> How to map the other way (OrderItem to Order) at the XML level?
> Appreciate your kind help all.
> 
> 
> 
> Hemant.Kamatgi wrote:
>> 
>> Try this(query and result map shown just as an example):
>> 
>> <sqlMap namespace="order">
>> 
>> <resultMap name="OrderMap" class="Order" groupby="id">
>> 
>>      <result property="id" column="ORDER_I">
>>      ...
>>      <result property="orderItemList" resultMap="order.OrderItemMap">
>> </resultMap>
>> 
>> <resultMap name="OrderItemMap" class="OrderItems">
>> 
>>      <result property="id" column="ORDER_ITEM_I" />
>>      .....
>> </resultMap>
>> 
>> <select name=getOrderDetails" parameterClass="Order"
>> resultMap="OrderMap">
>> 
>>      Select *
>>      From    Order or,
>>              OrderItem oi
>>      Where   or.id=#id#
>>      And     or.id=oi.id
>> </select>
>> 
>> </sqlMap>
>> 
>> Rgds
>> Hemant
>> 
>> -----Original Message-----
>> From: HHB [mailto:[EMAIL PROTECTED] 
>> Sent: Friday, July 27, 2007 6:21 PM
>> To: [email protected]
>> Subject: Basic mapping in iBatis
>> 
>> 
>> Hi.
>> I have these two entites: Order and OrderItem
>> ------------------
>> class Order {
>>   List orderItems;
>> }
>> class OrderItems {
>>   Order order;
>> }
>> -----------------
>> How to map this relationship at the XML level?
>> How can I load an Order with all its order items are fully initialized
>> (no 1
>> + N problem please)?
>> Thanks for help.
>> -- 
>> View this message in context:
>> http://www.nabble.com/Basic-mapping-in-iBatis-tf4160616.html#a11838111
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Basic-mapping-in-iBatis-tf4160616.html#a11885569
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Basic-mapping-in-iBatis-tf4160616.html#a11927463
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

Reply via email to