The <table> element is used to select a table in the database for introspection. Selected tables will cause the following objects to be generated for each table:
At least one <table> element must be specified as a required child element of the <abatorContext> element. You can specify unlimited table elements.
Attribute | Description |
---|---|
tableName | The name of the database table (not including the schema or catalog). The specified value can contain SQL wildcards if so desired. |
Attribute | Description | ||||||
---|---|---|---|---|---|---|---|
schema | The database schema - not required if your database does not use schemas, or if there is a default schema. The specified value can contain SQL wildcards if so desired. | ||||||
catalog | The database catalog - not required if your database does not use catalogs, or if there is a default catalog. | ||||||
alias | If specified, this value will be used to alias the table and all column names in any generated SQL select statement. Column names will be aliased with the pattern alias_actualColumnName. | ||||||
domainObjectName | The base name from which generated object names will be generated. If not specified, Abator will generate a name automatically based on the tableName. The name (either specified here, or generated automatically) will be used to compute generated domain class names and DAO class names. | ||||||
enableInsert | Signifies whether an insert statement should be generated.
The default is true. |
||||||
enableSelectByPrimaryKey | Signifies whether a select by primary key statement should be generated.
Regardless of this setting, the statement will not be generated if the
table does not have a primary key.
The default is true. |
||||||
enableSelectByExample | Signifies whether a select by example statement should be generated.
This statement enables many different dynamic queries to be generated at run time.
The default is true. |
||||||
enableUpdateByPrimaryKey | Signifies whether an update by primary key statement should be generated.
Regardless of this setting, the statement will not be generated if the
table does not have a primary key.
The default is true. |
||||||
enableDeleteByPrimaryKey | Signifies whether an delete by primary key statement should be generated.
Regardless of this setting, the statement will not be generated if the
table does not have a primary key.
The default is true. |
||||||
enableDeleteByExample | Signifies whether a delete by example statement should be generated.
This statement enables many different dynamic deletes to be generated at run time.
The default is true. |
||||||
selectByPrimaryKeyQueryId | This value will be added to the select list of the select by primary key statement in this form: "'<value>' as QUERYID". This can be useful for identifying queries in DBA tracing tools at run time. If you use thus value, you should specify a unique id for every different query generated by Abator. | ||||||
selectByExampleQueryId | This value will be added to the select list of the select by example statement in this form: "'<value>' as QUERYID". This can be useful for identifying queries in DBA tracing tools at run time. If you use thus value, you should specify a unique id for every different query generated by Abator. | ||||||
modelType |
This property is used to override the default model type if you desire
to do so for this table. If not specified, Abator will generate domain
objects based on the context default model type.
The model type defines how Abator will generate domain classes. With some
model types Abator will generate a single domain class for each table,
with others Abator may generate different classes depending on the structure
of the table. The property supports these values:
|
||||||
escapeWildcards | Signifies whether SQL wildcards ('_' and '%') in the schema and tableName should
be escaped when searching for columns. This is required by some drivers if the
schema or tableName includes an SQL wildcard (for example, if a table name is
MY_TABLE, some drivers require that the underscore character be escaped).
The default is false. |
This table lists the properties of the default SQL Map generators that can be specified with the <property> child element:
Property Name | Property Values |
---|---|
useActualColumnNames | If true, then
Abator will use column names as returned from the database metadata as the properties
of the generated domain objects. If false (default), Abator will attempt to camel
case the returned names. In either event, the name can be specified explicitly by the
<columnOverride> element in which case this property will be ignored for the
specified column.
For example, suppose a table contains a column START_DATE. If the value of
this property is "true", then Abator will generate the property name
as The default value is false. |
This element specifies that we always want to generate code for a table called MYTABLE in schema MYSCHEMA. We also want to ignore a column called "fred" in the table, and we want to override the column "BEG_DATE" so that the generated property name will be "startDate".
<table tableName="MYTABLE" schema="MYSCHEMA"> <ignoreColumn column="fred"/> <columnOverride column="BEG_DATE" property="startDate"/> </table>