Java Reference
In-Depth Information
Table 6-2.
Continued
Attribute Name
Target
Purpose
NamedNativeQuery/
Pk and T
Extends the corresponding EJB 3 named native
NamedNativeQueries
query functionality with various Hibernate-specific
query hints.
NamedQuery
/
NamedQueries
Pk and T
Extends the corresponding EJB 3 named query
functionality with various Hibernate-specific query
hints.
NotFound
M and F
Allows the behavior to be defined for circumstances
in which an expected entity is missing. The options
drawn from the
NotFoundAction
enumeration are
the self-explanatory
EXCEPTION
and
IGNORE
values.
The default is
EXCEPTION
.
OnDelete
T, M, and F
Allows Hibernate-specific behavior on deletion of
collections, arrays, and joined subclasses.
OrderBy
M and F
Allows a collection to be ordered by SQL rather than
HQL (as with the EJB 3 annotation) ordering.
ParamDef
Pm
Used to define parameters for
Filter
annotations.
Parameter
Used to declare parameters for
GenericGenerator
annotations.
Pm
Proxy
T
Allows the proxy behavior for an entity to be config-
ured or disabled.
Sort
M and F
Allows a collection to be sorted using a comparator.
Table
/
Tables
T
Allows indexes to be applied to a table (see the
“Applying Indexes with
@Table
and
@Index
” section
later in the chapter).
Type
M and F
Marks a field or an attribute as being a composite
user type.
TypeDef
/
TypeDefs
Pk and T
Allows a composite user type to be defined.
Where
T, M, and F
Applies a
Where
clause to an entity or association.
Key to the Target column: Pk = package, T = type, M = method, F = field, Pm = parameter
All the annotations and enumerations described here fall into the
org.hibernate.
annotations
package. When we refer to an EJB 3 annotation or enumeration, we will use
the fully qualified
javax.persistence.*
class name.
@Entity
The Hibernate-specific
@Entity
annotation extends the basic details of the
@javax.
persistence.Entity
annotation, but is otherwise used in the same contexts. It allows the
following additional attributes to be specified:
dynamicInsert
is used to flag that insert statements should be generated at run time (not
at startup), allowing only the altered columns to be inserted. By default this is disabled.
dynamicUpdate
is used to flag that update statements should be generated at run time,
allowing only the altered columns to be updated. By default this is disabled.
Search WWH ::
Custom Search