Java Reference
In-Depth Information
that. With i
BATIS
, you don't necessarily have to map every table to a user-defined
class. i
BATIS
allows you to map relational data to primitives, maps,
XML
, and user-
defined classes (e.g., JavaBeans). This great flexibility makes i
BATIS
extremely
effective for complex data models, including skinny data models.
1.5 Summary
i
BATIS
was designed as a hybrid solution that does not attempt to solve every prob-
lem, but instead solves the most important problems. i
BATIS
borrows from the var-
ious other methods of access. Like a stored procedure, every i
BATIS
statement has
a signature that gives it a name and defines its inputs and outputs (encapsula-
tion). Similar to inline
SQL
, i
BATIS
allows the
SQL
to be written in the way it was
supposed to be, and to use language variables directly for parameters and results.
Like Dynamic
SQL
, i
BATIS
provides a means of modifying the
SQL
at runtime.
Such queries can be dynamically built to reflect a user request. From object/rela-
tional mapping tools, i
BATIS
borrows a number of concepts, including caching,
lazy loading, and advanced transaction management.
In an application architecture, i
BATIS
fits in at the persistence layer. i
BATIS
supports other layers by providing features that allow for easier implementation
of requirements at all layers of the application. For example, a web search engine
may require paginated lists of search results. i
BATIS
supports such features by
allowing a query to specify an offset (i.e., a starting point) and the number of rows
to return. This allows the pagination to operate at a low level, while keeping the
database details out of the application.
i
BATIS
works with databases of any size or purpose. It works well for small
application databases because it is simple to learn and quick to ramp up. It is
excellent for large enterprise applications because it doesn't make any assump-
tions about the database design, behaviors, or dependencies that might impact
how our application uses the database. Even databases that have challenging
designs or are perhaps surrounded by political turmoil can easily work with i
BA-
TIS
. Above all else, i
BATIS
has been designed to be flexible enough to suit almost
any situation while saving you time by eliminating redundant boilerplate code.
In this chapter we've discussed the philosophy and the roots of i
BATIS
. In the
next chapter we'll explain exactly what i
BATIS
is and how it works.



