Abator generates Java classes that correspond to the fields in a database table. The generated classes are a type of domain object, but should in no way be confused with a rich domain model (see the Philosophy page for more on this subject). Abator generates different types of "domain" objects based on the characteristics of the table and configuration options.
Every field and method generated by Abator includes the non-standard JavaDoc tag
@abatorgenerated
. When run as an Eclipse plugin,
on subsequent runs of Abator every field and method that
includes this JavaDoc tag will be deleted and replaced. Any other field or method in the
class will be untouched by Abator.
With this in mind, you can add other fields and methods to the classes without fear of losing them in
subsequent runs of Abator - simply DO NOT include the @abatorgenerated
JavaDoc tag on anything that you add to the class.
Outside of the Eclipse plugin, Java files need to be merged by hand, but you can use the
@abatorgenerated
JavaDoc tag to know what is safe to delete from a prior
version of a file.
The following sections describe the different types of "domain" classes that will be
generated by Abator. Abator will generate different types of domain classes depending
on the value of the defaultModelType
attribute of the
<abatorContext>
configuration element and the modelType
attribute of the
<table>
configuration element.
Any column ignored by an <ignoreColumn> configuration element will by ignored and not added to any generated Java class.
Note: in the following descriptions, the term "BLOB" is used to refer to any column with a data type of BLOB, CLOB, LONGVARCHAR, or LONGVARBINARY.
This class will contain properties for each field in the primary key of a table.
The property names will be generated automatically by Abator, and based on the column name
in the table. The abator generated property names can be overridden with a
<columnOverride>
configuration element.
The name of the class will be «TableName»Key
by default, or
«domainObjectName»Key
if the domainObjectName
attribute is specified on the <table>
configuration element.
This class will be generated in the hierarchical model if the table has a primary key. This class will be generated in the conditional model if the table has more then one column in the primary key. This class will not be generated in the flat model.
This class will contain properties for each non-BLOB and non-primary key column in the table.
The class will extend the primary key class, if there is a primary key.
The property names will be generated automatically by Abator, and based on the column name
in the table. The abator generated property names can be overridden with a
<columnOverride>
configuration element.
The name of the class will be «TableName»
by default, or
«domainObjectName»
if the domainObjectName
attribute is specified on the <table>
configuration element.
This class will be generated in the hierarchical model if the table has non-BLOB and non-primary key columns. This class will be generated in the conditional model if the table has non-BLOB and non-primary key columns, or if there is only one primary key column or one BLOB column. This class is always generated in the flat model.
This class will contain properties for each BLOB column in the table.
The class will extend the record class, if there are other non-BLOB and non-Primary Key
columns in the table, else it will extend the primary key (note that Abator does not support
tables that only contain BLOB columns).
The property names will be generated automatically by Abator, and based on the column name
in the table. The abator generated property names can be overridden with a
<columnOverride>
configuration element.
This class will be the return value from the selectByPrimaryKey
method,
or the selectByExampleWithBLOBs
method.
The name of the class will be «TableName»WithBLOBs
by default, or
«domainObjectName»WithBLOBs
if the domainObjectName
attribute is specified on the <table>
configuration element.
This class will be generated in the hierarchical model if the table has any BLOB columns. This class will be generated in the conditional model if the table has more than one BLOB column. This class will not be generated in the flat model.
This class is used to work with Abator's dynamic select capability. The class holds a set of criteria that are used to generate a dynamic WHERE clause at runtime for the following methods:
selectByExample
selectByExampleWithBLOBs
deleteByExample
countByExample
updateByExample
This class may or may not extend one of the other generated domain classes based on the
table configuration, and the value of the generatorSet
attribute of the <abatorContext>
configuration element.
The name of the class will be «TableName»Example
by default, or
«domainObjectName»Example
if the domainObjectName
attribute is specified on the <table>
configuration element.
This class will be generated if any of the *ByExample
methods are enabled. Note that the configuration elements produced by these options can grow quite large.
With the "Legacy" generator set, the generated XML will have a very large SQL fragment
related to this capability, and the generated DAO class will have many
extra methods. With the "Java2" or "Java5" generator sets
the example class itself can grow quite large, but the DAO methods are small as is the generated XML
fragment.
If you do not plan to use the dynamic WHERE clause features of Abator, you may prefer to
disable the generation of these methods.
See the Example Class Usage page for details on using the example class.