Java Reference
In-Depth Information
The find method executes a query and returns a list of DTO s and a flag that tells
the presentation tier whether to display a “next page” button.
For example, the Food to Go application finds the orders using the OrderDAO ,
which is shown in figure 11.2. The OrderDAO defines a findOrders() method,
<<interface>>
OrderDAO
PagedQuery
Result
PagedQueryResult findOrders(startingIndex, pageSize,
OrderSearchCriteria)
more
findOrders(... ) {
...
sqlMapClientTemplate
.queryForList("findOrders",
... )
OrderDAO
IBatisImpl
OrderSummary
DTO
OrderSearch
Criteria
orderId
deliveryTime
deliveryAddress
...
findOrders()
...
}
restaurantName
...
Order.xml
org.
springframework.orm.iBatis
<sqlmap>
<select name="findOrders" ...>
SELECT *
FROM ORDER o, RESTAURANT r
WHERE ...
...
<isNotEmpty>
AND r.name = #restaurantName#
</isNotEmpty>
...
</select>
SqlMapClient
Template
SqlMapClient
DaoSupport
queryForList()
...
getSqlMapClientTemplate()
<resultMap
class="OrderSummaryDTO" ...>
...
</resultMap>
iBATIS
SqlMapClient
</sqlmap>
queryForList()
...
sqlMap-config.xml
<sqlMapConfig>
<sqlMap resource="Order.xml" />
...
</ sqlMapConfig>
Figure 11.2
The iBATIS implementation of the OrderDAO
 
 
Search WWH ::




Custom Search