Java Reference
In-Depth Information
Table 4-2. ( continued )
Annotation
Description
Elements
@MapKeyColumn
The MapKeyColumn annotation specifies the mapping of a
key column of a map when the key is of basic type.
name
unique
nullable
columnDefinition
table
length
precision
scale
@Enumerated,
@MapKeyEnumerated
Control whether string- or integer-valued columns are
generated for basic attributes of enumerated types and
therefore impact the default column mapping of these types.
@Temporal,
@MapKeyTemporal
Control whether date-, time-, or timestamp-value columns are
generated for basic attributes of temporal types, and therefore
impact the default column mappings for these types.
@Lob
Specifies that a persistent attribute is to be persisted to a
database large object type.
@OrderColumn
Specifies the generation of a column that is used to maintain
the persistent ordering of a list that is represented in an
element collection, one-to-many, or many-to-many
relationship.
name
nullable
columnDefinition
@DiscriminatorColumn
A discriminator column is generated for the SINGLE_TABLE
mapping strategy and may optionally be generated by the
provider for use with the JOINED inheritance strategy.
@Version
Specifies the generation of a column to serve as an entity's
optimistic lock.
@Id
Specifies attributes whose database columns correspond to a
primary key. Use of the Id annotation results in the creation
of a primary key consisting of the corresponding column or
columns.
@EmbeddedId
Specifies an embedded attribute whose corresponding
columns correspond to a database primary key. Use of the
EmbeddedId annotation results in the creation of a primary
key consisting of the corresponding columns.
@GeneratedValue
Indicates a primary key whose value is to be generated by the
provider. If a strategy is indicated, the provider must use it if
it is supported by the target database.
@JoinColumn
The JoinColumn annotation is typically used in specifying a
foreign key mapping. In general, the foreign key definitions
created will be provider-dependent and database-dependent.
Applications that are sensitive to the exact mapping that is
used should use the foreignKey element of the JoinColumn
annotation or include DDL files that specify how the
database schemas are to be generated.
name
referencedColumnName
unique
nullable
columnDefinition
table
foreignKey
( continued )
Search WWH ::




Custom Search