In the previous section, we saw that a
uses an array of column names. Field mappings, however, use full-fledged
Column annotations. Column annotations have the following
String columnDefinition: The database-specific column type
name. This property is only used by vendors that support creating tables from
your mapping metadata. During table creation, the vendor will use the value of
columnDefinition as the declared column type. If no
columnDefinition is given, the vendor will choose an
appropriate default based on the field type combined with the column's length,
precision, and scale.
int length: The column length. This property is typically
only used during table creation, though some vendors might use it to validate
data before flushing.
columns typically default to a length of 255; other column types use the
String table: Sometimes you will need to map fields to
tables other than the primary table. This property allows you specify that the
column resides in a secondary table. We will see how to map fields to secondary
tables later in the chapter.
The equivalent XML element is
column. This element has
attributes that are exactly equivalent to the
annotation's properties described above: