このコンテンツは選択した言語では利用できません。

12.3. Hibernate Annotations


12.3.1. Hibernate Annotations

Expand
Table 12.7. Hibernate Defined Annotations
Annotation Description
AccessType Property Access type.
Any Defines a ToOne association pointing to several entity types. Matching the according entity type is done through a metadata discriminator column. This kind of mapping should be only marginal.
AnyMetaDef Defines @Any and @manyToAny metadata.
AnyMedaDefs Defines @Any and @ManyToAny set of metadata. Can be defined at the entity level or the package level.
BatchSize Batch size for SQL loading.
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.
Columns Support an array of columns. Useful for component user type mappings.
ColumnTransformer Custom SQL expression used to read the value from and write a value to a column. Use for direct object loading/saving as well as queries. The write expression must contain exactly one '?' placeholder for the value.
ColumnTransformers Plural annotation for @ColumnTransformer. Useful when more than one column is using this behavior.
DiscriminatorFormula Discriminator formula to be placed at the root entity.
DiscriminatorOptions Optional annotation to express Hibernate specific discriminator properties.
Entity Extends Entity with Hibernate features.
Fetch Defines the fetching strategy used for the given association.
FetchProfile Defines the fetching strategy profile.
FetchProfiles Plural annotation for @FetchProfile.
Filter Adds filters to an entity or a target entity of a collection.
FilterDef Filter definition.
FilterDefs Array of filter definitions.
FilterJoinTable Adds filters to a join table collection.
FilterJoinTables Adds multiple @FilterJoinTable to a collection.
Filters Adds multiple @Filters.
Formula To be used as a replacement for @Column in most places. The formula has to be a valid SQL fragment.
Generated This annotated property is generated by the database.
GenericGenerator Generator annotation describing any kind of Hibernate generator in a detyped manner.
GenericGenerators Array of generic generator definitions.
Immutable
Mark an Entity or a Collection as immutable. No annotation means the element is mutable.
An immutable entity may not be updated by the application. Updates to an immutable entity will be ignored, but no exception is thrown.
@Immutable placed on a collection makes the collection immutable, meaning additions and deletions to and from the collection are not allowed. A HibernateException is thrown in this case.
Index Defines a database index.
JoinFormula To be used as a replacement for @JoinColumn in most places. The formula has to be a valid SQL fragment.
LazyCollection Defines the lazy status of a collection.
LazyToOne Defines the lazy status of a ToOne association (i.e. OneToOne or ManyToOne).
Loader Overwrites Hibernate default FIND method.
ManyToAny Defines a ToMany association pointing to different entity types. Matching the according entity type is done through a metadata discriminator column. This kind of mapping should be only marginal.
MapKeyType Defines the type of key of a persistent map.
MetaValue Represents a discriminator value associated to a given entity type.
NamedNativeQueries Extends NamedNativeQueries to hold Hibernate NamedNativeQuery objects.
NamedNativeQuery Extends NamedNativeQuery with Hibernate features.
NamedQueries Extends NamedQueries to hold Hibernate NamedQuery objects.
NamedQuery Extends NamedQuery with Hibernate features.
NaturalId Specifies that a property is part of the natural id of the entity.
NotFound Action to do when an element is not found on an association.
OnDelete Strategy to use on collections, arrays and on joined subclasses delete. OnDelete of secondary tables is currently not supported.
OptimisticLock Whether or not a change of the annotated property will trigger an entity version increment. If the annotation is not present, the property is involved in the optimistic lock strategy (default).
OptimisticLocking Used to define the style of optimistic locking to be applied to an entity. In a hierarchy, only valid on the root entity.
OrderBy Order a collection using SQL ordering (not HQL ordering).
ParamDef A parameter definition.
Parameter Key/value pattern.
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.
RowId Support for ROWID mapping feature of Hibernate.
Sort Collection sort (Java level sorting).
Source Optional annotation in conjunction with Version and timestamp version properties. The annotation value decides where the timestamp is generated.
SQLDelete Overwrites the Hibernate default DELETE method.
SQLDeleteAll Overwrites the Hibernate default DELETE ALL method.
SQLInsert Overwrites the Hibernate default INSERT INTO method.
SQLUpdate Overwrites the Hibernate default UPDATE method.
Subselect Maps an immutable and read-only entity to a given SQL subselect expression.
Synchronize Ensures that auto-flush happens correctly and that queries against the derived entity do not return stale data. Mostly used with Subselect.
Table Complementary information to a table either primary or secondary.
Tables Plural annotation of Table.
Target Defines an explicit target, avoiding reflection and generics resolving.
Tuplizer Defines a tuplizer for an entity or a component.
Tuplizers Defines a set of tuplizers for an entity or a component.
Type Hibernate Type.
TypeDef Hibernate Type definition.
TypeDefs Hibernate Type definition array.
Where Where clause to add to the element Entity or target entity of a collection. The clause is written in SQL.
WhereJoinTable Where clause to add to the collection join table. The clause is written in SQL.

Note

The annotation "Entity" is deprecated and scheduled for removal in future releases.
トップに戻る
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2025 Red Hat