ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hemant.Kamatgi <Hemant.Kama...@target.com>
Subject RE: Basic mapping in iBatis
Date Mon, 30 Jul 2007 14:20:26 GMT
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:hubaghdadi@yahoo.ca] 
Sent: Friday, July 27, 2007 6:21 PM
To: user-java@ibatis.apache.org
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.

Mime
View raw message