Java Reference
In-Depth Information
In the previous chapter, we talked about an example where you had 1,000 cus-
tomer accounts with 1,000 orders each, and 25 items on each order. Loading all of
that data would require creating 25,000,000 objects, and keeping them in mem-
ory. Using lazy loading we reduce that requirement to a number closer to 2,500,
which is one ten-thousandth of the original number.
The lazyLoadingEnabled setting is used to indicate whether or not you want to
use lazy loading when you have related mapped statements (which we will talk about
in section 6.2.2). Valid values are true or false , and the default value is true .
In our sample SqlMapConfig.xml file earlier, lazy loading is enabled.
cacheModelsEnabled
Caching is a performance-enhancement technique where recently used data is
kept in memory based on the assumption that it will be needed again in the
future. The cacheModelsEnabled setting is used to indicate whether or not you
want i BATIS to use caching. As with most of the values of the <settings> element,
valid values are true or false .
In our earlier example, caching is enabled, which is the default. To take advan-
tage of caching, you must also configure cache models for your mapped state-
ments, which are introduced in section 9.1.
enhancementEnabled
The enhancementEnabled setting is used to indicate whether or not you want to
use cglib optimized classes to improve performance with lazy loading. Again, valid
values are true or false , and the default value is true .
cglib is a runtime code generation library that allows i BATIS to optimize
certain functions, like the setting of JavaBeans properties. Also, it allows
you to lazily load concrete classes and thus avoid having to create an
interface for the lazy loaded type. You can get cglib from http://
cglib.sourceforge.net/. As with any performance enhancement, you
should probably avoid using it unless you are sure you need it.
NOTE
In our previous example, we are allowing enhancements, but if cglib is not on the
classpath, the enhancements will be silently disabled.
useStatementNamespaces
The useStatementNamespaces setting is used to tell i BATIS to require qualified
names for mapped statements. Valid values are true or false , and the default
value is false .
In other words, when the SQL maps are defined (see the section 4.2.1 for more
information on that), the map name is to be used to qualify the mapped statement.
Search WWH ::




Custom Search