Java Reference
In-Depth Information
The persistence layer
The persistence layer is where i BATIS
fits and is therefore the focus of this
topic. In an object-oriented system, the
primary concern of the persistence
layer is the storage and retrieval of
objects, or more specifically the data
stored in those objects. In enterprise
applications persistence layers usually
interact with relational database systems
for storing data, although in some cases
other durable data structures and medi-
ums might be used. Some systems may
use simple comma-delimited flat files or
XML files. Because of the disparate
nature of persistence strategies in
enterprise applications, a secondary
concern of the persistence layer is
abstraction. The persistence layer
should hide all details of how the data is
being stored and how it is retrieved.
Such details should never be exposed
to the other layers of the application.
To better understand these concerns
and how they're managed, it helps to sep-
arate the persistence layer into three basic parts: the abstraction layer, the persis-
tence framework, and the driver or interface, as shown in the lower part of figure 1.3.
Let's take a closer look at each of these three parts.
Business Object
Business Logic
Abstraction Layer
Persistence Framework
Driver / Interface
Figure 1.3 Persistence layer zoomed to show
internal layered design
The abstraction layer
The role of the abstraction layer is to provide a consistent and meaningful inter-
face to the persistence layer. It is a set of classes and methods that act as a façade
to the persistence implementation details. Methods in the abstraction layer
should never require any implementation-specific parameters, nor should it
return any values or throw any exceptions that are exclusive to the persistence
implementation. With a proper abstraction layer in place, the entire persistence
approach—including both the persistence API and the storage infrastructure—
should be able to change without modifications to the abstraction layer or any of
Search WWH ::

Custom Search