The <ibatorPlugin> Element
The <ibatorPlugin> element is used to define a plugin. Plugins can be used
to extend or modify the code generated by Ibator. This element is a child element of the
<ibatorContext> element. Any number of
plugins may be specified in a context. The plugins will be called in
the order that are listed in the configuration.
For more information about plugins, see the
Implementing Ibator Plugins reference
Ibator Supplied Plugins
Ibator supplies several plugins (all are in the package
org.apache.ibatis.ibator.plugins). The supplied plugins demonstrate
different types of tasks that can be accomplished with Ibator plugins. Source
code for the plugins is available with the Ibator downloads, or can be viewed
|This plugin adds
hashCode methods to the
Java model objects generated by Ibator.
equals method generated by this class is correct in most
cases, but will probably NOT be correct if you have specified a rootClass -
because our equals method only checks the fields it knows about.
hashCode method generated by this class is a very simplistic
implementation. A better implementation would rely on the HashCodeUtil
- but we do not want to introduce another
dependancy in this simple plugin.
|This plugin demonstrates usage of the
by renaming the generated example classes generated by Ibator.
This plugin accepts two properties:
- searchString (required) a regular expression used to search
the default generated name of the example class.
- replaceString (required) the string to be inserted on matches of the
For example, to rename the generated example classes from xxxExample to
xxxCriteria, specify Example$ for searchString
and Criteria for replaceString
|This plugin adds the marker interface
java.io.Serializable to the
Java model objects generated by Ibator. This plugin also adds the
serialVersionUID field to the model classes.
Important: This is a simplistic implementation of java.io.Serializable and does
not attempt to do any versioning of classes.
|This plugin generates a skeleton SqlMapConfig.xml file that contains
references to the SqlMap.xml files generated by Ibator.
This plugin accepts three properties:
- fileName (optional) the name of the generated file.
this defaults to "SqlMapConfig.xml" if not specified.
- targetPackage (required) the name of the package where the
file should be placed. Specified like "com.mycompany.sql".
- targetProject (required) the name of the project where the
file should be placed.
the same rules as the
values on the sqlMapGenerator configuration element.
||The fully qualified name of the class that implements the plugin.
The class must implement the interface
and must have a public default constructor. Note that it is far
easier to extend the adapter class
than to implement the entire interface.