Java Reference
In-Depth Information
dataSource = new SimpleDataSource(map);
public DataSource getDataSource() {
return dataSource;
As we've said before, more complex DataSource implementations might take a lot
more work, but we hope that never becomes an issue you need to worry over.
The final topic we will cover in extending iBATIS is customizing your transac-
tion management.
12.5 Customizing transaction management
iBATIS offers a number of transaction options, as you've read in earlier chapters.
However, there is always room for customization with today's wide range of appli-
cation servers and custom approaches to transaction management. From the out-
side, transactions seem simple, offering only a few functions: start, commit, roll
back, and end. But on the inside, transactions are very complex and are one of
the behaviors of application servers that tend to deviate from the standard. For
that reason, iBATIS allows you to customize your own transaction management sys-
tem. If you've had any experience in the area, that statement probably sent shivers
down your spine—and so it should. Implementing a transaction manager cor-
rectly is a terribly difficult thing to do. For that reason, we won't even bother tack-
ling a true implementation here. Instead, we'll discuss the interfaces in detail,
which will help you gain a head start should you ever be tasked with implement-
ing them. If you do want an example, iBATIS comes with three implementations:
JDBC , JTA , and EXTERNAL . Table 12.4 summarizes these, in case you missed them
in previous chapters.
Table 12.4
Built-in transaction manager configurations
Uses the transaction facilities provided by the JDBC Connection API
Starts a global transaction, or joins an existing global transaction
“No-op” implementation of commit and rollback, thus leaving com-
mit and rollback to some external transaction manager
Search WWH ::

Custom Search