Java Reference
In-Depth Information
OK
, so now that you know what your options are, let's take a closer look to see
what makes each one unique.
The EXTERNAL transaction manager
The
EXTERNAL
transaction manager is the simplest to configure (it has no prop-
erties, and any that are passed to it are ignored), but potentially the most difficult
to use, because you are 100 percent responsible for all transaction management
in your application.
The HIBERNATE transaction manager
The
HIBERNATE
transaction manager is also very simple to configure. It takes all
of the properties that are passed to it, and simply passes them on to the Hibernate
session factory. In addition, any properties that are passed in with names that
begin with
class.
are assumed to be classes to be managed by Hibernate, and are
added to the configuration object that is used to build the session factory. Like-
wise, any properties passed in that begin with
map.
are assumed to be mapping
files, and are also added to the configuration object.
The JDBC transaction manager
The
JDBC
transaction manager is probably the most difficult one to configure.
The
DataSource
property is required for this transaction manager and must be
one of the following:
SIMPLE
,
DBCP
, or
JNDI
.
The SIMPLE data source
The
SIMPLE
data source is an implementation of the i
BATIS
SimpleDataSource
,
which is a stand-alone implementation ideal for minimal overhead and depen-
dencies. It has five required properties:
■
JDBC.Driver
—This is the fully qualified name of the
JDBC
driver to be used
for managing transactions in this
DAO
context.
■
JDBC.ConnectionURL
—This is the
JDBC
URL
that is to be used to connect to
the database for this
DAO
context.
■
JDBC.Username
—This is the username that is to be used to connect to the
database for this
DAO
context.
■
JDBC.Password
—This is the password of the user to be used to connect to
the database for this
DAO
context.
■
JDBC.DefaultAutoCommit
—If
true
(or any expression that the Boolean class
in Java interprets as true), then the
autoCommit
property of connections
returned by this data source will be set to true in this
DAO
context.
