Java Reference
In-Depth Information
and SQL programmers. i BATIS configuration files can be easily understood by
nearly anyone with any SQL programming experience.
The primary purpose of any good framework is to make the developer more pro-
ductive. Generally a framework exists to take care of common tasks, reduce boiler-
plate code, and solve complex architectural challenges. i BATIS succeeds in making
developers more productive. In one case study presented at a Java Users Group in
Italy (, Fabrizio Giannes-
chi found that i BATIS reduced the amount of code in the persistence layer by a sig-
nificant 62 percent. This savings was primarily due to the fact that no JDBC code
had to be written. The SQL was still handcoded, but as you saw earlier in this chap-
ter, the SQL is not the problem—it's the JDBC API , and ADO.NET is no different.
The topic of performance will spark debate among framework authors, users, and
even commercial software vendors. The fact is, at a low level all frameworks incur
some sort of overhead. Generally, if you compare handcoded JDBC to i BATIS and
iterate it 1,000,000 times in a for loop, you'll likely see a performance hit in favor
of JDBC . Fortunately, this is not the kind of performance that matters in modern
application development. What is much more significant is how you fetch data
from the database, when you fetch it, and how often. For example, using a pagi-
nated list of data that dynamically fetches records from the database can signifi-
cantly increase the performance of the application because you aren't
unnecessarily loading potentially thousands of records from the database at once.
Similarly, using features like lazy loading will avoid loading data that isn't neces-
sarily used in a given use case. On the other hand, if you know for certain that you
have to load a complex object graph that involves a large amount of data from a
number of tables, loading it using a single SQL statement will improve perfor-
mance greatly. i BATIS supports a number of performance optimizations that we'll
discuss in more detail later. For now, it is important to know that i BATIS can usu-
ally be configured and used in such a way that is simple, yet it performs as well as
JDBC , or possibly better. Another important consideration is that not all JDBC
code is well written. JDBC is a complex API that requires a lot of care to code cor-
rectly. Unfortunately, much JDBC code is poorly written and therefore will not
even perform as well as i BATIS at a low level.
Search WWH ::

Custom Search