Java Reference
In-Depth Information
the layers that depend on it. There are patterns that can help with the implemen-
tation of a proper abstraction layer, the most popular of which is the Data Access
Objects ( DAO ) pattern. Some frameworks, including i BATIS , implement this pattern
for you. We discuss the i BATIS DAO framework in chapter 11.
The persistence framework
The persistence framework is responsible for interfacing with the driver (or inter-
face). The persistence framework will provide methods for storing, retrieving,
updating, searching, and managing data. Unlike the abstraction layer, a persis-
tence framework is generally specific to one class of storage infrastructure. For
example, you might find a persistence API that deals exclusively with XML files for
storing data. However, with most modern enterprise applications, a relational
database is the storage infrastructure of choice. Most popular languages come
with standard API s for accessing relational databases. JDBC is the standard frame-
work for Java applications to access databases, while ADO.NET is the standard data-
base persistence framework for . NET applications. The standard API s are general
purpose and as a result are very complete in their implementation, but also very
verbose and repetitive in their use. For these reasons many frameworks have been
built on top of the standard ones to extend the functionality to be more specific,
and therefore more powerful. i BATIS is a persistence framework that deals exclu-
sively with relational databases of all kinds and supports both Java and . NET using
a consistent approach.
The driver or interface
The storage infrastructure can be as simple as a comma-delimited flat file or as
complex as a multimillion-dollar enterprise database server. In either case, a soft-
ware driver is used to communicate with the storage infrastructure at a low level.
Some drivers, such as native file system drivers, are very generic in functionality
but specific to a platform. You will likely never see a file input/output ( I/O )
driver, but you can be sure that it is there. Database drivers, on the other hand,
tend to be complex and differ in implementation, size, and behavior. It is the job
of the persistence framework to communicate with the driver so that these differ-
ences are minimized and simplified. Since i BATIS only supports relational data-
bases, that is what we'll focus on in this topic.
1.2.5
The relational database
i BATIS exists entirely to make accessing relational databases easier. Databases are
complex beasts that can involve a lot of work to use them properly. The database
Search WWH ::




Custom Search