Package org.hibernate.annotations
Package containing all Hibernate's specific annotations.
Basic value mapping
Hibernate supports 2 approaches to defining a mapping strategy for basic values:-
A "compositional" approach using a combination of the following influencers for
various parts of mapping
JavaType
JdbcType
JdbcTypeCode
Mutability
AttributeConverter
/Convert
Lob
Enumerated
Temporal
Nationalized
JavaType
,JdbcType
,JdbcTypeCode
andMutability
all have specialized forms for the various model parts such as map-key, list-index, (id-bag) collection-id, etc. -
Contracted via the
UserType
interface and specified usingCustomType
. As with the compositional approach, there are model-part specific annotations for specifying custom-types as well.
-
Class Summary Class Description CurrentTimestampGeneration Value generation strategy for using the database `current_timestamp` function to generate the valuesNoAttributeConverter<O,R> QueryHints Consolidation of hints available to Hibernate JPA queries. -
Enum Summary Enum Description CacheConcurrencyStrategy Cache concurrency strategy.CacheModeType Enumeration for the different interaction modes between the session and the Level 2 Cache.CascadeType Cascade types (can override default JPA cascades).FetchMode Fetch options on associations.FlushModeType Enumeration extending jakarta.persistence flush modes.GenerationTime At what time(s) will the generation occur?LazyCollectionOption Lazy options available for a collection.LazyToOneOption Lazy options available for a ToOne association.NotFoundAction Possible actions when an associated entity is not found in the database.OnDeleteAction Possible actions for on-delete.OptimisticLockType Possible optimistic locking strategies.PolymorphismType Type of available polymorphism for a particular entity.ResultCheckStyle Possible styles of checking return codes on SQL INSERT, UPDATE and DELETE queries.SourceType Where should Hibernate retrieve the value from? From the database, or from the current JVM?TimeZoneStorageType Describes the storage for the time zone information for time zone based types.TimeZoneType The type of storage to use for the time zone information. -
Annotation Types Summary Annotation Type Description Any Maps a discriminated to-one style associations 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 (seeInheritance
andInheritanceType.SINGLE_TABLE
for details about discriminated inheritance mappings).AnyDiscriminator Simplified form for describing the discriminator value mapping as a discrete set.AnyDiscriminatorValue Specifies the mapping for a single any-valued discriminator value to the corresponding entityAnyDiscriminatorValues Grouping of AnyDiscriminatorValueAnyKeyJavaClass Specifies the Java Class to use for the foreign-key handling related to an ANY mapping.AnyKeyJavaType Form ofJavaType
used to describe the foreign-key part of an ANY mapping.AnyKeyJdbcType Form ofJdbcType
used to describe the foreign-key part of an ANY mapping.AnyKeyJdbcTypeCode Form ofJdbcTypeCode
used to describe the foreign-key part of an ANY mapping.AttributeAccessor Names a persistent property access strategy (PropertyAccessStrategy
) to use.BatchSize Defines size for batch loading of collections or lazy entities.Cache Add caching strategy to a root entity or a collection.Cascade Apply a cascade strategy on an association.Check Arbitrary SQL CHECK constraints which can be defined at the class, property or collection level.CollectionId Describe an identifier column for a bag (ie an idbag).CollectionIdCustomType Form ofCustomType
for describing the id of an id-bag mappingCollectionIdJavaType Form ofJavaType
for describing the id of an id-bag mappingCollectionIdJdbcType Form ofJdbcType
for describing the id of an id-bag mappingCollectionIdJdbcTypeCode Form ofJdbcTypeCode
for describing the id of an id-bag mappingCollectionIdMutability Form ofMutability
for describing the id of an id-bag mappingCollectionType Deprecated. Custom handling for "collection types" will be handled differently in 6.0ColumnDefault Identifies the DEFAULT value to apply to the associated column via DDL.Columns Support an array of columns.ColumnTransformer Custom SQL expression used to read the value from and write a value to a column.ColumnTransformers Plural annotation for @ColumnTransformer.Comment SQL column comment which can be defined at property level.CreationTimestamp Marks a property as the creation timestamp of the containing entity.CurrentTimestamp Specifies to use the database `current_timestamp` function for generating values for the associated attribute based onCurrentTimestamp.timing()
CustomType DiscriminatorFormula Used to apply a Hibernate formula (derived value) as the inheritance discriminator "column".DiscriminatorOptions Optional annotation to express Hibernate specific discriminator properties.DynamicInsert For inserting, should this entity use dynamic sql generation where only non-null columns get referenced in the prepared sql statement?DynamicUpdate For updating, should this entity use dynamic sql generation where only changed columns get referenced in the prepared sql statement?EmbeddableInstantiator Specifies a custom instantiator implementationEmbeddableInstantiatorRegistration Registers a custom instantiator implementationEmbeddableInstantiatorRegistrations Fetch Define the fetching strategy used for the given association.FetchProfile Define the fetching strategy profile.FetchProfile.FetchOverride Descriptor for a particular association override.FetchProfiles Collects together multiple fetch profiles.Filter Add filters to an entity or a target entity of a collection.FilterDef Filter definition.FilterDefs Array of filter definitions.FilterJoinTable Add filters to a join table collection.FilterJoinTables Add multiple@FilterJoinTable
to a collection.Filters Add multiple@Filters
.ForeignKey Deprecated. Prefer the JPA 2.1 introducedForeignKey
instead.Formula Defines a formula (derived value) which is a SQL fragment that acts as a @Column alternative in most cases.Generated The annotated property is generated by the database.GeneratorType Deprecated. Most uses can be changed to useValueGenerationType
+AnnotationValueGeneration
GenericGenerator Generator annotation describing any kind of Hibernate generator in a generic (de-typed) manner.GenericGenerators Array of generic generator definitions.Immutable Mark an Entity, a Collection, or an Attribute type as immutable.Index Deprecated. UsingIndex
instead.IndexColumn Deprecated. Prefer the standard JPAOrderColumn
annotation and the Hibernate specificListIndexBase
(for replacingIndexColumn.base()
).JavaType Specify an explicit BasicJavaDescriptor to use for a particular column mapping.JavaTypeRegistration Registers the BasicJavaDescriptor to use for the givenJavaTypeRegistration.javaType()
Registrations applied to a package are processed before Hibernate begins to process any attributes, etc.JavaTypeRegistrations Grouping ofJavaTypeRegistration
See notes onJavaTypeRegistration
about using on packages versus use on classesJdbcType Specifies an explicitJdbcType
to use for a particular column mapping. When applied to a Map-valued attribute, describes the Map value.JdbcTypeCode Specifies the JDBC type-code to use for the column mapping. When applied to a Map-valued attribute, describes the Map value.JdbcTypeRegistration Describes a SqlTypeDescriptor to be added to theJdbcTypeRegistry
Registrations applied to a package are processed before Hibernate begins to process any attributes, etc.JdbcTypeRegistrations Grouping ofJdbcTypeRegistration
See notes onJdbcTypeRegistration
about using on packages versus use on classesJoinColumnOrFormula Allows joins based on column or a formula.JoinColumnsOrFormulas Collection of@JoinColumnOrFormula
definitions.JoinFormula To be used as a replacement for@JoinColumn
in most places.LazyCollection Define the lazy status of a collection.LazyGroup For use with bytecode-enhanced lazy-loading support.LazyToOne Define the laziness options available for a ToOne (ie OneToOne or ManyToOne) association.ListIndexBase Defines the start index value for a list index as stored on the database.ListIndexJavaType Form ofJavaType
for describing the column mapping for the index of a List or arrayListIndexJdbcType Form ofJdbcType
for describing the column mapping for the index of a List or arrayListIndexJdbcTypeCode Form ofJdbcTypeCode
for describing the column mapping for the index of a List or arrayLoader Used to override how Hibernate performs load operations.ManyToAny This is the collection-valued form of @Any definitions.MapKeyCustomType Form ofCustomType
for use with map-keysMapKeyJavaType Form ofJavaType
for describing the key of a MapMapKeyJdbcType Form ofJdbcType
for describing the key of a MapMapKeyJdbcTypeCode Form ofJdbcTypeCode
for describing the key of a MapMapKeyMutability Form ofMutability
for describing the key of a MapMutability Used to specify the MutabilityPlan for a basic value mapping. When applied to a Map-valued attribute, describes the Map value.NamedNativeQueries A grouping of Hibernate-specificNamedNativeQuery
definitions.NamedNativeQuery ExtendsNamedNativeQuery
with Hibernate features.NamedQueries A grouping of Hibernate-specificNamedQuery
definitions.NamedQuery ExtendsNamedQuery
with Hibernate features.Nationalized Used to indicate that the annotated character data should be stored with nationalization support.NaturalId This specifies that a property is part of the natural id of the entity.NaturalIdCache Used to specify that the natural id values associated with the annotated entity should be cached in Hibernate's shared (L2) cache.NotFound Action to do when an element is not found on a association.OnDelete Strategy to use on collections, arrays and on joined subclasses delete.OptimisticLock Whether or not a change of the annotated property will trigger an entity version increment.OptimisticLocking Used to define the style of optimistic locking to be applied to an entity.OrderBy Order a collection using SQL ordering (not HQL ordering).ParamDef A parameter definition.Parameter Generic parameter (basically a key/value combination) used to parametrize other annotations.Parent Reference the property as a pointer back to the owner (generally the owning entity).Persister Specify a custom persister.Polymorphism Used to define the type of polymorphism Hibernate will apply to entity hierarchies.Proxy Lazy and proxy configuration of a particular class.Remove Indicates that the annotated element is planned for removal as part of a deprecation lifecycle.RowId Support forROWID
mapping feature of Hibernate.SelectBeforeUpdate Should the entity's current state be selected from the database when determining whether to perform an update when re-attaching detached entities?SortComparator Specifies in-memory Set/Map sorting using a specifiedComparator
for sorting.SortNatural Specifies in-memory Set/Map sorting using natural sorting.Source Optional annotation in conjunction withVersion
and timestamp version properties indicating the source of the timestamp value.SQLDelete Custom SQL statement for delete of an entity/collection.SQLDeleteAll Custom SQL statement for delete of all of a collection's elements.SqlFragmentAlias Describe aliases for filters.SQLInsert Custom SQL statement for insertion of an entity/collection.SQLUpdate Custom SQL statement for update of an entity/collection.Subselect Map an immutable and read-only entity to a given SQL select expression.Synchronize Ensures that auto-flush happens correctly and that queries against the derived entity do not return stale data.Table Complementary information to a table either primary or secondary.Tables A grouping of tables.Target Define an explicit target, avoiding reflection and generics resolving.TimeZoneColumn Specifies the column name and type to use for storing the time zone information.TimeZoneStorage Specifies how the time zone information of a persistent property or field should be persisted.UpdateTimestamp Marks a property as the update timestamp of the containing entity.ValueGenerationType Marks an annotation type as a generator annotation type.Where Where clause to add to the element Entity or target entity of a collection.WhereJoinTable Where clause to add to the collection join table.