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
JavaTypeJdbcTypeJdbcTypeCodeMutabilityAttributeConverter/ConvertLobEnumeratedTemporalNationalized
JavaType,JdbcType,JdbcTypeCodeandMutabilityall have specialized forms for the various model parts such as map-key, list-index, (id-bag) collection-id, etc. -
Contracted via the
UserTypeinterface and specified usingType. As with the compositional approach, there are model-part specific annotations for specifying custom-types as well.
-
Interface Summary Interface Description DialectOverride Allows certain annotations to be overridden in a given SQLDialect. -
Class Summary Class Description CurrentTimestampGeneration Value generation strategy for using the database `current_timestamp` function to generate the valuesNoAttributeConverter<O,R> QueryHints Deprecated. UseAvailableHintsinstead -
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 Enumerates the association fetching strategies available in Hibernate.FlushModeType Enumeration extendingJPA flush modeswith flush modes specific to Hibernate, and a "null" flush mode,FlushModeType.PERSISTENCE_CONTEXTfor use as a default annotation value.GenerationTime Represents the timing of value generation that occurs in the database.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 of timezone information for zoned datetime types.TimeZoneType The type of storage to use for the time zone information.UuidGenerator.Style -
Annotation Types Summary Annotation Type Description Any Maps a discriminated to-one 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 (seeInheritanceandInheritanceType.SINGLE_TABLEfor 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 ofJavaTypeused to describe the foreign-key part of an ANY mapping.AnyKeyJdbcType Form ofJdbcTypeused to describe the foreign-key part of an ANY mapping.AnyKeyJdbcTypeCode Form ofJdbcTypeCodeused to describe the foreign-key part of an ANY mapping.AttributeAccessor Names a persistent property access strategy (PropertyAccessStrategy) to use.AttributeBinderType Associates a user-defined annotation with anAttributeBinder, allowing the annotation to drive some custom model binding.Bag Can be used to map aList-valued attribute usingCollectionClassification.BAGsemantics.BatchSize Specifies a batch size for batch fetching of the annotated entity or collection.Cache Add caching strategy to a root entity or a collection.Cascade Apply a cascade strategy on an association.Check Specifies acheckconstraint to be included in the generated DDL.CollectionId Describe an identifier column for a bag.CollectionIdJavaType Form ofJavaTypefor describing the id of an id-bag mappingCollectionIdJdbcType Form ofJdbcTypefor describing the id of an id-bag mappingCollectionIdJdbcTypeCode Form ofJdbcTypeCodefor describing the id of an id-bag mappingCollectionIdMutability Form ofMutabilityfor describing the id of an id-bag mappingCollectionIdType Form ofTypefor describing the id of an id-bag mappingCollectionType Names a custom collection type for a persistent collection.CollectionTypeRegistration Allows to register aUserCollectionTypeto use as the default for the specified classification of collection.CollectionTypeRegistrations Repeatable container forCollectionTypeRegistrationColumnDefault Specifies that a column has adefaultvalue specified in 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 Specifies a comment that will be included in generated DDL.CreationTimestamp Marks a property as the creation timestamp of the containing entity.CurrentTimestamp Specifies that the databasecurrent_timestampfunction is used to generate values of the annotated attribute, based onCurrentTimestamp.timing().DialectOverride.Check Specializes aCheckin a certain dialect.DialectOverride.Checks DialectOverride.ColumnDefault Specializes aColumnDefaultin a certain dialect.DialectOverride.ColumnDefaults DialectOverride.DiscriminatorFormula Specializes aDiscriminatorFormulain a certain dialect.DialectOverride.DiscriminatorFormulas DialectOverride.FilterDefOverrides DialectOverride.FilterDefs SpecializesFilterDefsin a certain dialect.DialectOverride.FilterOverrides DialectOverride.Filters SpecializesFiltersin a certain dialect.DialectOverride.Formula Specializes aFormulain a certain dialect.DialectOverride.Formulas DialectOverride.GeneratedColumn Specializes aGeneratedColumnin a certain dialect.DialectOverride.GeneratedColumns DialectOverride.JoinFormula Specializes aJoinFormulain a certain dialect.DialectOverride.JoinFormulas DialectOverride.OrderBy Specializes anOrderByin a certain dialect.DialectOverride.OrderBys DialectOverride.OverridesAnnotation Marks an annotation type as a dialect-specific override for some other annotation type.DialectOverride.Version Identifies a database version.DialectOverride.Where Specializes aWherein a certain dialect.DialectOverride.Wheres DiscriminatorFormula Specifies an expression written in native SQL as the discriminator for an entity inheritance hierarchy.DiscriminatorOptions Optional annotation to express Hibernate specific discriminator properties.DynamicInsert Specifies that SQLinsertstatements for the annotated entity are generated dynamically, and only include the columns to which a non-null value must be assigned.DynamicUpdate Specifies that SQLupdatestatements for the annotated entity are generated dynamically, and only include columns which are actually being updated.EmbeddableInstantiator Specifies a custom instantiator for a specific embeddedEmbeddableInstantiatorRegistration Registers a custom instantiator implementation to be used for all references to a particularEmbeddable.EmbeddableInstantiatorRegistrations Grouping ofEmbeddableInstantiatorRegistrationFetch Specify the fetching strategy used for the annotated 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@FilterJoinTableto a collection.Filters Add multiple@Filters.ForeignKey Deprecated. use the JPA 2.1ForeignKeyannotationFormula Specifies an expression written in native SQL that is used to read the value of an attribute instead of storing the value in aColumn.Generated Specifies that the value of the annotated property is generated by the database.GeneratedColumn Specifies that a column is defined using a DDLgenerated always asclause or equivalent, and that Hibernate should fetch the generated value from the database after each SQLINSERTorUPDATE.GeneratorType Deprecated. Most uses can be changed to useValueGenerationType+AnnotationValueGenerationGenericGenerator Generator annotation describing any kind of Hibernate generator in a generic (de-typed) manner.GenericGenerators Array of generic generator definitions.IdGeneratorType Meta-annotation used to mark another annotation as providing configuration for a customIdentifierGenerator.Immutable Marks an entity, collection, or attribute as immutable.Index Deprecated. UsingIndexinstead.IndexColumn Deprecated. Prefer the standard JPAOrderColumnannotation and the Hibernate specificListIndexBase(for replacingIndexColumn.base()).JavaType Specify an explicit BasicJavaType to use for a particular column mapping.JavaTypeRegistration Registers the BasicJavaType to use for the givenJavaTypeRegistration.javaType()JavaTypeRegistrations Grouping ofJavaTypeRegistrationSee notes onJavaTypeRegistrationabout using on packages versus use on classesJdbcType Specifies an explicitJdbcTypeto 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 theJdbcTypeRegistryJdbcTypeRegistrations Grouping ofJdbcTypeRegistrationSee notes onJdbcTypeRegistrationabout using on packages versus use on classesJoinColumnOrFormula JoinColumnsOrFormulas JoinFormula Specifies a join condition based on an arbitrary native SQL formula instead of a column name.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 ofJavaTypefor describing the column mapping for the index of a List or arrayListIndexJdbcType Form ofJdbcTypefor describing the column mapping for the index of a List or arrayListIndexJdbcTypeCode Form ofJdbcTypeCodefor 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 ofTypefor use with map-keysMapKeyJavaType Form ofJavaTypefor describing the key of a MapMapKeyJdbcType Form ofJdbcTypefor describing the key of a MapMapKeyJdbcTypeCode Form ofJdbcTypeCodefor describing the key of a MapMapKeyMutability Form ofMutabilityfor describing the key of a MapMutability Used to specify aMutabilityPlanfor a basic value mapping.NamedNativeQueries A grouping of Hibernate-specificNamedNativeQuerydefinitions.NamedNativeQuery ExtendsNamedNativeQuerywith Hibernate features.NamedQueries A grouping of Hibernate-specificNamedQuerydefinitions.NamedQuery ExtendsNamedQuerywith Hibernate features.Nationalized Specifies 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 Specifies that the natural id values associated with the annotated entity should be cached in the shared second-level 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 Specifies whether updating the annotated attribute should trigger an increment to theversionof the entity instance.OptimisticLocking Used to define the style of optimistic locking to be applied to an entity.OrderBy Order a collection using an expression written in native SQL.ParamDef Details about a parameter defined in a FilterDef.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 Specifies that an Oracle-stylerowidshould be used in SQLupdatestatements for an entity, instead of the primary key.SelectBeforeUpdate Specifies that the current persistent state of a detached entity instance should be fetched from the database when the entity is reattached usingSession.update(Object).SortComparator SortNatural Source Optional annotation in conjunction withVersionand 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 Maps an immutable and read-only entity to a given SQLselectexpression.Synchronize Ensures that auto-flush happens correctly and that queries against the derived entity do not return stale data.Table Complementary information for a table declared using theTable, orSecondaryTableannotation.Tables A grouping of tables.Target Define an explicit target, avoiding reflection and generics resolving.TenantId Identifies a field of an entity that holds a tenant id in discriminator-based multitenancy.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.Type UpdateTimestamp Marks a property as the update timestamp of the containing entity.UuidGenerator Specifies that an entity identifier is generated as an RFC 4122 UUID.ValueGenerationType Marks an annotation type as a generator annotation type.Where Specifies a restriction written in native SQL to add to the generated SQL when querying an entity or collection.WhereJoinTable Specifies a restriction written in native SQL to add to the generated SQL when querying thejoin tableof a collection.