The <columnOverride> Element
MyBatis Generator (MBG) uses the <columnOverride> element to change certain attributes of an introspected database column from the values that would be calculated by default. This element is an optional child element of the <table> element.
Optional Attributes
Attribute | Description |
---|---|
property | The name of a Java property to be used. If not specified, MBG will generate properties based on the column name. For example, if a table has a column named "STRT_DTE" then MBG will generate the property name as either "STRT_DTE" or "strtDte" based on the value of the "useActualColumnNames" property (see the description of the <table> element for more information). This property could be used to rename the column "startDate" |
javaType | The fully qualified Java Type of the property for this column. This can be used to override the type calculated by the JavaTypeResolver if required. For some databases, this is necessary to handle "odd" database types (e.g. MySql's unsigned bigint type should be mapped to java.lang.Object). |
jdbcType | The JDBC Type (INTEGER, DECIMAL, NUMERIC, VARCHAR, etc.) for the column. This can be used to override the type calculated by the JavaTypeResolver if required. For some databases this is necessary to handle JDBC driver quirks (e.g. DB2's LONGVARCHAR type should be mapped to VARCHAR for iBATIS). |
typeHandler | A user defined type handler that should be used for this column. This should be the fully qualified name of a class that implements iBATIS' TypeHandler or TypeHandlerCallback interface (TypeHandlerCallback is simpler to implement). If unspecified, or blank, then iBATIS will use the default type facility for handling types. Important: MBG does not verify that this type handler exists, or is valid. MBG simply inserts this value at the appropriate places in the generated SQL Map configuration file. |
delimitedColumnName | Specifies whether the column name should be delimited in the generated SQL.
MBG will automatically delimit the column name if the name contains a space,
so this override is only necessary when the column name must be forced to a certain
case, or when the column name is a reserved word in the database.
When "true", the column attribute for the override must exactly match the case of the column name returned from the database. The delimiter characters are specified on the <context> element. The default value is false. However, MBG will automatically delimit column names that contain a space, so no override is necessary in that case. |
Child Elements
- <property> (0..N) Note: any properties specified here will be added to the properties collection of the corresponding IntrospectedColumn. MBG does not currently respond to any properties. This element is provided so that special values for each column may be provided to a plugin in the event that a plugin is coded to generate or modify something unique to a particular column.