Java Reference
In-Depth Information
The statements and result maps shown in this diagram are as follows:
findPendingOrder is a statement that retrieves the pending order and its res-
taurant.
PendingOrderResultMap is the result map for the ResultSet returned find-
PendingOrder statement. It maps the columns of this ResultSet to properties
of a PendingOrderDTO and RestaurantDTO . It also executes the nested SQL
SELECT statements to retrieve the line items and menu items.
findLineItems is a statement that retrieves the PendingOrder 's line items.
PendingOrderLineItemResultMap maps the columns of the ResultSet
returned by findLineItems to properties of the PendingOrderLineItemDTO .
findMenuItems is a statement that retrieves the restaurant's menu items.
MenuItemResultMap is a result map that maps the columns of the ResultSet
returned by findMenuItems to the properties of the MenuItemDTO .
Listing 9.6 shows an excerpt of the i BATIS XML file that defines these statements
and result maps.
Listing 9.6
Excerpt of PendingOrder.xml
<sqlMap>
B
<select id="findPendingOrder"
parameterClass="java.lang.String"
bbbbbbbb resultMap="PendingOrderResultMap">
select *
from PENDING_ORDER o, RESTAURANT r
where
o.pending_order_id = #value#
AND r.restaurant_id (+)= o.restaurant_id
</select>
C
<resultMap id="PendingOrderResultMap"
class="net.chrisrichardson.foodToGo…PendingOrderDTO">
<result property="pendingOrderId" column="PENDING_ORDER_ID"/>
<result property="state" column="STATE"/>
<result property="deliveryTime" column="DELIVERY_TIME"/>
<result property="deliveryAddress.street1"
column="DELIVERY_STREET1"/>
<result property="deliveryAddress.street2"
column="DELIVERY_STREET2"/>
<result property="deliveryAddress.city"
column="DELIVERY_CITY"/>
<result property="deliveryAddress.state"
column="DELIVERY_STATE"/>
 
Search WWH ::




Custom Search