Java Reference
In-Depth Information
The first SELECT statement is executed when findPendingOrder() calls i BATIS and
retrieves the pending order and its restaurant using an outer join. The other two
statements are automatically executed by the first statement's result map when it
initializes the PendingOrderDTO and RestaurantDTO objects. The second statement
retrieves the line items and their associated menu items. The third statement
retrieves the menu items for the restaurant. Figure 9.7 shows the statements and
result maps that we must write to execute these statements.
select *
from FTGO_PENDING_ORDER_LINE_ITEM l,
FTGO_MENU_ITEM mi
where l.pending_order_id = ?
AND mi.menu_item_id = l.menu_item_id
select *
from
FTGO_PENDING_ORDER o,
FTGO_RESTAURANT r
where o.pending_order_id = ?
AND r.restaurant_id (+)=
o.restaurant_id
<<statement>>
findPendingOrder
PendingOrder
DTO
uses
creates
<<result map>>
PendingOrder
ResultMap
creates
Restaurant
DTO
executes
executes
select *
from FTGO_MENU_ITEM mi
where mi.restaurant_id = ?
<<statement>>
findLineItems
<<statement>>
findMenuItems
uses
uses
<<result map>>
PendingOrderLine
ItemResultMap
<<result map>>
MenuItemResult
Map
creates
creates
PendingOrder
LineItem
DTO
MenuItem
DTO
Figure 9.7 Mapped statements and result maps required to load a pending order, its line items,
restaurant, and menu items
Search WWH ::




Custom Search