Java Reference
In-Depth Information
Here is an explanation of what is happening in this listing:
B
Create an i BATIS SqlMapClient using the i BATIS descriptor files that are listed in
the configuration file sqlMap-config.xml:
<sqlMapConfig>
<sqlMap resource="PendingOrder.xml" />
</sqlMapConfig>
Create the Spring SqlMapClientTemplate .
Create PendingOrderDAOImpl and wire it to the SqlMapClientTemplate .
Create the RestaurantDAOImpl and wire it to the SqlMapClientTemplate .
Create the PlaceOrderTransactionScripts injecting the PendingOrderDAO and
RestaurantDAO .
Configure the TransactionInterceptor to use the DataSourceTransactionManager .
Apply the DataSourceTransactionInterceptor to the PlaceOrderTransaction-
Scripts .
Create a DataSourceTransactionManager that begins and commits a transaction
that uses a JDBC connection that is bound to the thread for use by the DAO s.
C
D
E
F
G
H
I
J
Create a JDBC DataSource implemented using Database Connection Pool ( DBCP ),
which is an open source connection pool.
When the presentation tier asks the Spring lightweight container for PlaceOrder-
TransactionScripts , Spring will instantiate all of these components and return a
PlaceOrderTransactionScripts that is wrapped with a TransactionInterceptor
that executes each method within a transaction.
The application's classes, along with the Spring bean definitions and the i BA-
TIS configuration files, would then be packaged and deployed as part of a web
application in a web container.
9.6 Summary
The Transaction Script pattern is a procedural approach that organizes the busi-
ness logic into a set of transaction scripts. A transaction script is a method that
accesses the database and performs computations and updates the database. There
is usually one transaction script for each request from the presentation tier, and
they are grouped together to form a transaction script class. For example, the trans-
action script version of the Place Order use case consists of a transaction script class
that defines a separate transaction script for each step of the use case.
 
 
 
 
 
Search WWH ::




Custom Search