se. It is a SQL Mapper. The difference is that i BATIS does not know or care about the
mappings between classes and database tables. Therefore there is no requirement
that the sub maps use a class that extends from the class referenced in the parent
result map. In other words, you're free to use discriminators however you like, for
whatever purpose seems natural. Of course, inheritance is an obvious application,
but you may find other situations where discriminators come in handy.
6.4 Other miscellaneous uses
The i BATIS framework is designed to be flexible. The <statement> mapped state-
ment type is another way to open more doors for uses that may not be possible
using the other mapped statement types.
Using the statement type and DDL
The <statement> type is a bit of an oddball in that unlike all of the other types
( <insert> , <update> , <delete> , and <select> ) it has no corresponding method to
call it with. That is a hint: the use of <statement> is not encouraged, and it should
be employed only as a last resort.
Data Definition Language ( DDL ) is a subset of SQL statements that are used to
define the structure of a database schema. You would use DDL to define tables
and indexes, and to perform other operations that do not change the data, but
change the data structure instead.
Although using DDL is officially unsupported, your database may allow you to
execute DDL statements via i BATIS using the <statement> type. The Postgre SQL
database, for example, allows using the <statement> type to create and drop data-
DROP TABLE Account CASCADE;
There are no guarantees that your database will support running DDL statements
this way, but if so, it can be useful for writing routines that create or modify data-
In the next section, we look at one of the features of i BATIS that makes it very
flexible but that is often overlooked: row handlers.
Search WWH ::