The final element to set up is the <sqlMap> tag. This tag specifies the location
of the SQLMap configuration files. Whenever i BATIS is accessed for the first time,
the configured SQLMap s and their contents will be loaded into memory so that the
SQL contents can be executed when needed.
We'll need to create a SQLMap file to house our SQL call for the category product
list. Within this file, which we'll name Product.xml , we will need to define a
typeAlias for the Product object, a cache model to cache results, and a select
statement to house our select SQL (see listing 14.17).
SQLMap Product.xml SQL file
<cacheModel id="productCache" type="LRU">
<property name="size" value="100"/>
WHERE CATEGORYID = #value#
The typeAlias will define an alias to the fully qualified class name of the Product
domain object. Here, we'll specify the alias product . This saves us time typing the
fully qualified class name every time we refer to the Product domain object.
Our cache model is going to be quite simple. We'll configure its type as LRU
and name it productCache . Since the LRU has the potential to last a long time, we