Top Description Annotations Classes Enums
[default module]

Package org.hibernate.annotations


Package containing all the Hibernate specific annotations.

Annotation Summary

Modifier and TypeAnnotation and Description
public @interface
AccessType

Deprecated Use AttributeAccessor instead; renamed to avoid confusion with the JPA javax.persistence.AccessType enum.
Property Access type.
public @interface
Any

Defines a ToOne-style association pointing to one of several entity types depending on a local discriminator, as opposed to discriminated inheritance where the discriminator is kept as part of the entity hierarchy.

public @interface
AnyMetaDef

Deprecated To be removed in 6.0
Used to provide metadata about an Any or ManyToAny mapping.
public @interface
AnyMetaDefs

Deprecated To be removed in 6.0
Used to group together AnyMetaDef annotations.
public @interface
AttributeAccessor

Names a persistent property access strategy (org.hibernate.property.access.spi.PropertyAccessStrategy) to use.

public @interface
BatchSize

Defines size for batch loading of collections or lazy entities.

public @interface
Cache

Add caching strategy to a root entity or a collection.

public @interface
Cascade

Apply a cascade strategy on an association.

public @interface
Check

Arbitrary SQL CHECK constraints which can be defined at the class, property or collection level.

public @interface
CollectionId

Describe an identifier column for a bag (ie an idbag).

public @interface
CollectionType

Deprecated Custom handling for "collection types" will be handled differently in 6.0
Names a custom collection type for a persistent collection.
public @interface
ColumnDefault

Identifies the DEFAULT value to apply to the associated column via DDL.

public @interface
Columns

Support an array of columns.

public @interface
ColumnTransformer

Custom SQL expression used to read the value from and write a value to a column.

public @interface
ColumnTransformers

Plural annotation for @ColumnTransformer.

public @interface
Comment

SQL column comment which can be defined at property level.

public @interface
CreationTimestamp

Marks a property as the creation timestamp of the containing entity.

public @interface
DiscriminatorFormula

Used to apply a Hibernate formula (derived value) as the inheritance discriminator "column".

public @interface
DiscriminatorOptions

Optional annotation to express Hibernate specific discriminator properties.

public @interface
DynamicInsert

For inserting, should this entity use dynamic sql generation where only non-null columns get referenced in the prepared sql statement?

public @interface
DynamicUpdate

For updating, should this entity use dynamic sql generation where only changed columns get referenced in the prepared sql statement?

public @interface
Entity

Deprecated See individual attributes for intended replacements. To be removed in 4.1
Extends javax.persistence.Entity with Hibernate features.
public @interface
Fetch

Define the fetching strategy used for the given association.

public @interface
FetchProfile

Define the fetching strategy profile.

public @interface
FetchProfiles

Collects together multiple fetch profiles.

public @interface
Filter

Add filters to an entity or a target entity of a collection.

public @interface
FilterDef

Filter definition.

public @interface
FilterDefs

Array of filter definitions.

public @interface
FilterJoinTable

Add filters to a join table collection.

public @interface
FilterJoinTables

Add multiple @FilterJoinTable to a collection.

public @interface
Filters

Add multiple @Filters.

public @interface
ForeignKey

Deprecated Prefer the JPA 2.1 introduced javax.persistence.ForeignKey instead.
Define the foreign key name.
public @interface
Formula

Defines a formula (derived value) which is a SQL fragment that acts as a @Column alternative in most cases.

public @interface
Generated

The annotated property is generated by the database.

public @interface
GeneratorType

Marks a property as generated, specifying the ValueGenerator type to be used for generating the value.

public @interface
GenericGenerator

Generator annotation describing any kind of Hibernate generator in a generic (de-typed) manner.

public @interface
GenericGenerators

Array of generic generator definitions.

public @interface
Immutable

Mark an Entity, a Collection, or an Attribute type as immutable.

public @interface
Index

Deprecated Using javax.persistence.Index instead.
Define a DB index.
public @interface
IndexColumn

Deprecated Prefer the standard JPA javax.persistence.OrderColumn annotation and the Hibernate specific ListIndexBase (for replacing base()).
Describe an index column of a List.
public @interface
JoinColumnOrFormula

Allows joins based on column or a formula.

public @interface
JoinColumnsOrFormulas

Collection of @JoinColumnOrFormula definitions.

public @interface
JoinFormula

To be used as a replacement for @JoinColumn in most places.

public @interface
LazyCollection

Define the lazy status of a collection.

public @interface
LazyGroup

For use with bytecode-enhanced lazy-loading support.

public @interface
LazyToOne

Define the laziness options available for a ToOne (ie OneToOne or ManyToOne) association.

public @interface
ListIndexBase

Defines the start index value for a list index as stored on the database.

public @interface
Loader

Used to override how Hibernate performs load operations.

public @interface
ManyToAny

This is the collection-valued form of @Any definitions.

public @interface
MapKeyType

Deprecated 6.0 will introduce a new type-safe CustomType annotation
Allows defining the type of the key of a persistent map.
public @interface
MetaValue

Maps a given discriminator value to the corresponding entity type.

public @interface
NamedNativeQueries

A grouping of Hibernate-specific NamedNativeQuery definitions.

public @interface
NamedNativeQuery

Extends javax.persistence.NamedNativeQuery with Hibernate features.

public @interface
NamedQueries

A grouping of Hibernate-specific NamedQuery definitions.

public @interface
NamedQuery

Extends javax.persistence.NamedQuery with Hibernate features.

public @interface
Nationalized

Marks a character data type (String, Character, character, Clob) as being a nationalized variant (NVARCHAR, NCHAR, NCLOB, etc).

public @interface
NaturalId

This specifies that a property is part of the natural id of the entity.

public @interface
NaturalIdCache

Used to specify that the natural id values associated with the annotated entity should be cached in Hibernate's shared (L2) cache.

public @interface
NotFound

Action to do when an element is not found on a association.

public @interface
OnDelete

Strategy to use on collections, arrays and on joined subclasses delete.

public @interface
OptimisticLock

Whether or not a change of the annotated property will trigger an entity version increment.

public @interface
OptimisticLocking

Used to define the style of optimistic locking to be applied to an entity.

public @interface
OrderBy

Order a collection using SQL ordering (not HQL ordering).

public @interface
ParamDef

A parameter definition.

public @interface
Parameter

Generic parameter (basically a key/value combination) used to parametrize other annotations.

public @interface
Parent

Reference the property as a pointer back to the owner (generally the owning entity).

public @interface
Persister

Specify a custom persister.

public @interface
Polymorphism

Used to define the type of polymorphism Hibernate will apply to entity hierarchies.

public @interface
Proxy

Lazy and proxy configuration of a particular class.

public @interface
RowId

Support for ROWID mapping feature of Hibernate.

public @interface
SelectBeforeUpdate

Should the entity's current state be selected from the database when determining whether to perform an update when re-attaching detached entities?

public @interface
Sort

Deprecated Use SortComparator or SortNatural instead depending on need.
Collection sort (in-memory sorting).
public @interface
SortComparator

Specifies in-memory Set/Map sorting using a specified Comparator for sorting.

public @interface
SortNatural

Specifies in-memory Set/Map sorting using natural sorting.

public @interface
Source

Optional annotation in conjunction with javax.persistence.Version and timestamp version properties indicating the source of the timestamp value.

public @interface
SQLDelete

Custom SQL statement for delete of an entity/collection.

public @interface
SQLDeleteAll

Custom SQL statement for delete of all of a collection's elements.

public @interface
SqlFragmentAlias

Describe aliases for filters.

public @interface
SQLInsert

Custom SQL statement for insertion of an entity/collection.

public @interface
SQLUpdate

Custom SQL statement for update of an entity/collection.

public @interface
Subselect

Map an immutable and read-only entity to a given SQL select expression.

public @interface
Synchronize

Ensures that auto-flush happens correctly and that queries against the derived entity do not return stale data.

public @interface
Table

Complementary information to a table either primary or secondary.

public @interface
Tables

A grouping of tables.

public @interface
Target

Define an explicit target, avoiding reflection and generics resolving.

public @interface
Tuplizer

Define a tuplizer for an entity or a component.

public @interface
Tuplizers

Grouping of tuplizers.

public @interface
Type

Defines a Hibernate type mapping.

public @interface
TypeDef

A type definition.

public @interface
TypeDefs

Plural form of TypeDef.

public @interface
UpdateTimestamp

Marks a property as the update timestamp of the containing entity.

public @interface
ValueGenerationType

Marks an annotation type as a generator annotation type.

public @interface
Where

Where clause to add to the element Entity or target entity of a collection.

public @interface
WhereJoinTable

Where clause to add to the collection join table.

Class Summary

Modifier and TypeClass and Description
public class
QueryHints

Consolidation of hints available to Hibernate JPA queries.

Enum Summary

Modifier and TypeEnum and Description
public enum
CacheConcurrencyStrategy

Cache concurrency strategy.

public enum
CacheModeType

Enumeration for the different interaction modes between the session and the Level 2 Cache.

public enum
CascadeType

Cascade types (can override default JPA cascades).

public enum
FetchMode

Defines how the association should be fetched, compared to javax.persistence.FetchType which defines when it should be fetched

public enum
FlushModeType

Enumeration extending javax.persistence flush modes.

public enum
GenerationTime

At what time(s) will the generation occur?

public enum
LazyCollectionOption

Lazy options available for a collection.

public enum
LazyToOneOption

Lazy options available for a ToOne association.

public enum
NotFoundAction

Possible actions when the database contains a non-null fk with no matching target.

public enum
OnDeleteAction

Possible actions for on-delete.

public enum
OptimisticLockType

Possible optimistic locking strategies.

public enum
PolymorphismType

Type of available polymorphism for a particular entity.

public enum
ResultCheckStyle

Possible styles of checking return codes on SQL INSERT, UPDATE and DELETE queries.

public enum
SortType

Deprecated Since Sort is deprecated.
Possible collection sorting strategies.
public enum
SourceType

Where should Hibernate retrieve the value from?