The <sqlMapGenerator> element is used to define properties of the SQL map generator. The SQL Map Generator builds an iBATIS formatted SQL map for each introspected table. This element is a required child element of the <ibatorContext> element.
Attribute | Description |
---|---|
targetPackage | This is the package where the generated SQL Maps will be placed. In the default generators, the property "enableSubPackages" controls how the actual package is calculated. If true, then the calculated package will be the targetPackage plus sub packages for the table's catalog and schema if they exist. If false (the default) then the calculated package will be exactly what is specified in the targetPackage attribute. Ibator will create folders as required for the generated packages. |
targetProject | This is used to specify a target project for the generated SQL maps. When running in the Eclipse environment, this specifies the project and source folder where the objects will be saved. In other environments, this value should be an existing directory on the local file system. Ibator will not create this directory if it does not exist. |
None
This table lists the properties of the default SQL Map generators that can be specified with the <property> child element:
Property Name | Property Values |
---|---|
enableSubPackages | This property is used to select whether Ibator will generate different
Java packages for the objects based on the catalog and schema of the
introspected table.
For example, suppose a table MYTABLE in schema MYSCHMA. Also suppose that the targetPackage attribute is set to "com.mycompany". If this property is true, the generated SQL Map for the table will be placed in the package "com.mycompany.myschema". If the property is false, the generated SQL Map will be placed in the "com.mycompany" schema. The default value is false. |
This element specifies that we always want to place generated SQL Maps in the "'test.model" package and that we want to use subpackages based on the table schema and catalog.
<sqlMapGenerator targetPackage="test.model" targetProject="\MyProject\src"> <property name="enableSubPackages" value="true" /> </sqlMapGenerator>