Java Reference
In-Depth Information
n Tip It is possible to overstate the importance of portability—most bespoke applications are never
deployed to an environment other than the one for which they were originally developed. As a mature prod-
uct, Hibernate 3 has numerous features to offer above and beyond the base EJB 3 specification. You should
not waste too much time trying to achieve a portable solution in preference to these proprietary features
unless you have a definite requirement for portability.
Table 6-2. The Hibernate Annotations
Attribute Name
Target
Purpose
AccessType
T, M, and F
Allows the default access type (normally deter-
mined by the placement of the @javax.
persistence.Id annotation) for the annotated
object to be overridden.
BatchSize
T, M, and F
Allows the batch size for a query to be specified.
Cache
Allows a cache concurrency strategy ( NONE ,
NONSTRICT_READ_WRITE , READ_ONLY , READ_WRITE , or
TRANSACTIONAL ) to be selected.
T, M, and F
Cascade
M and F
Applies a Hibernate-specific cascade strategy to an
association.
Check
T, M, and F
Allows an arbitrary SQL constraint to be specified
during the schema generation.
CollectionOfElements
M and F
Allows a collection field or an attribute to be
marked as a collection of elements or embedded
objects, rather than a full-fledged association with
an entity.
Columns
Allows an array of @javax.persistence.Column
annotations to be applied to an annotated
Hibernate composite user type.
M and F
DiscriminatorFormula
T
Allows the discriminator type to be determined
with an HQL formula instead of the default EJB 3
mechanisms.
Entity
T
Allows Hibernate-specific attributes to be applied
in addition to the javax.persistence.Entity anno-
tation information.
Filter / Filters
T, M, and F
Adds named filters to an entity or a collection.
FilterDef / FilterDefs
Pk and T
Allows named filters to be declared.
Formula
MF
Allows an SQL formula to be used in place of values
drawn from a column.
GenericGenerator
Pk, T, M, and F
Allows a Hibernate-specific generator to be used
when creating a primary key value for the entity.
Index
M and F
Allows a database index to be defined for a column
or columns.
IndexColumn
M and F
Allows a collection to maintain an order on the
basis of an index column maintaining the element
ordering (i.e., collection ordering rather than data-
base ordering).
Continued
Search WWH ::




Custom Search