Java Reference
In-Depth Information
Listing 14.12
transactionManager configuration in dao.xml
<transactionManager type="SQLMAP">
<property name="SqlMapConfigResource"
"org/apache/ibatis/jgamestore/persistence/sqlmapdao/sql/sql -map-
The next step involved in configuring dao.xml is mapping the interface to the
implementation (see listing 14.13). This is quite easy to do—it only requires that
the <dao> tag provide a value to the interface attribute that corresponds with a
fully qualified interface name. The implementation will then be a fully qualified
class name implementation of that interface. If the configured implementation
class does not utilize the specified interface, i BATIS DAO will be sure to let you
know at runtime.
Listing 14.13
DAO configuration in dao.xml
Transaction demarcation
When using the SQLMAP type with the i BATIS DAO framework, you have implicit
and explicit transaction management. By default, if you do not specify a transac-
tion explicitly, it will be started automatically for you. There are ways to avoid this;
you can read about that in chapters 4 and 10.
Implicit transaction management with the SQLMAP type is simple—all we need
to do is call the method on our data access object (see listing 14.14). The transac-
tion management is performed automatically for us. In the case of a select, we
don't need the transaction, but it doesn't hurt to have it.
Listing 14.14
Example of implicit transaction management
public PaginatedList getProductListByCategory(
String categoryId
) {
Search WWH ::

Custom Search