Java Reference
In-Depth Information
Transaction Script pattern, there are only three layers: the transaction scripts, the
DAO s, and the Spring/i BATIS class.
So far, we have implemented the transaction scripts and tested them using
mock DAO s. The next step in the process of implementing the transaction script-
based business logic is to implement those DAO s, which include PendingOrderDAO
and RestaurantDAO . As figure 9.6 shows, each DAO consists of an interface and an
implementation class. The interface makes it easy to swap implementations. It
<<interface>>
RestaurantDAO
<<interface>>
PendingOrderDAO
findAvailableRestaurants()
findRestaurant()
findOrCreatePendingOrder()
savePendingOrder()
RestaurantDAOImpl
PendingOrderDAOImpl
findAvailableRestaurants()
findRestaurant()
findOrCreatePendingOrder()
savePendingOrder()
PendingOrder.xml
<sqlmap>
<select ..>
SELECT *
FROM PENDING_ORDER
WHERE
</select>
org.
springframework.orm.iBatis
SqlMapClient
Template
SqlMapClient
DaoSupport
<insert... >
INSERT INTO PENDING _ORDER
...
</insert>
queryForList()
update()
delete()
...
getSqlMapClientTemplate()
<resultMap
class="PendingOrderDTO" ...>
...
</resultMap>
</sqlmap>
iBATIS
SqlMapClient
sqlMap-config.xml
queryForList()
update()
delete()
...
<sqlMapConfig>
<sqlMap resource="PendingOrder .xml" />
</sqlMapConfig>
Figure 9.6
iBATIS DAO classes and configuration files
Search WWH ::




Custom Search