HHH-13062 - Migrate User Guide links from Java EE 7 to 8

This commit is contained in:
Vlad Mihalcea 2018-10-25 17:39:42 +03:00
parent 2517fbfe6f
commit 3bf530d5e8
14 changed files with 126 additions and 126 deletions

View File

@ -7,45 +7,45 @@
[[annotations-jpa-access]] [[annotations-jpa-access]]
==== `@Access` ==== `@Access`
The http://docs.oracle.com/javaee/7/api/javax/persistence/Access.html[`@Access`] annotation is used to specify the access type of the associated entity class, mapped superclass, or embeddable class, or entity attribute. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Access.html[`@Access`] annotation is used to specify the access type of the associated entity class, mapped superclass, or embeddable class, or entity attribute.
See the <<chapters/domain/access.adoc#access,Access type>> section for more info. See the <<chapters/domain/access.adoc#access,Access type>> section for more info.
[[annotations-jpa-associationoverride]] [[annotations-jpa-associationoverride]]
==== `@AssociationOverride` ==== `@AssociationOverride`
The http://docs.oracle.com/javaee/7/api/javax/persistence/AssociationOverride.html[`@AssociationOverride`] annotation is used to override an association mapping (e.g. `@ManyToOne`, `@OneToOne`, `@OneToMany`, `@ManyToMany`) inherited from a mapped superclass or an embeddable. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/AssociationOverride.html[`@AssociationOverride`] annotation is used to override an association mapping (e.g. `@ManyToOne`, `@OneToOne`, `@OneToMany`, `@ManyToMany`) inherited from a mapped superclass or an embeddable.
See the <<chapters/domain/embeddables.adoc#embeddable-override, Overriding Embeddable types>> section for more info. See the <<chapters/domain/embeddables.adoc#embeddable-override, Overriding Embeddable types>> section for more info.
[[annotations-jpa-associationoverrides]] [[annotations-jpa-associationoverrides]]
==== `@AssociationOverrides` ==== `@AssociationOverrides`
The http://docs.oracle.com/javaee/7/api/javax/persistence/AssociationOverrides.html[`@AssociationOverrides`] is used to group several <<annotations-jpa-associationoverride>> annotations. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/AssociationOverrides.html[`@AssociationOverrides`] is used to group several <<annotations-jpa-associationoverride>> annotations.
[[annotations-jpa-attributeoverride]] [[annotations-jpa-attributeoverride]]
==== `@AttributeOverride` ==== `@AttributeOverride`
The http://docs.oracle.com/javaee/7/api/javax/persistence/AttributeOverride.html[`@AttributeOverride`] annotation is used to override an attribute mapping inherited from a mapped superclass or an embeddable. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/AttributeOverride.html[`@AttributeOverride`] annotation is used to override an attribute mapping inherited from a mapped superclass or an embeddable.
See the <<chapters/domain/embeddables.adoc#embeddable-override, Overriding Embeddable types>> section for more info. See the <<chapters/domain/embeddables.adoc#embeddable-override, Overriding Embeddable types>> section for more info.
[[annotations-jpa-attributeoverrides]] [[annotations-jpa-attributeoverrides]]
==== `@AttributeOverrides` ==== `@AttributeOverrides`
The http://docs.oracle.com/javaee/7/api/javax/persistence/AttributeOverrides.html[`@AttributeOverrides`] is used to group several <<annotations-jpa-attributeoverride>> annotations. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/AttributeOverrides.html[`@AttributeOverrides`] is used to group several <<annotations-jpa-attributeoverride>> annotations.
[[annotations-jpa-basic]] [[annotations-jpa-basic]]
==== `@Basic` ==== `@Basic`
The http://docs.oracle.com/javaee/7/api/javax/persistence/Basic.html[`@Basic`] annotation is used to map a basic attribute type to a database column. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Basic.html[`@Basic`] annotation is used to map a basic attribute type to a database column.
See the <<chapters/domain/basic_types.adoc#basic,Basic types>> chapter for more info. See the <<chapters/domain/basic_types.adoc#basic,Basic types>> chapter for more info.
[[annotations-jpa-cacheable]] [[annotations-jpa-cacheable]]
==== `@Cacheable` ==== `@Cacheable`
The http://docs.oracle.com/javaee/7/api/javax/persistence/Cacheable.html[`@Cacheable`] annotation is used to specify whether an entity should be stored in the second-level cache. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Cacheable.html[`@Cacheable`] annotation is used to specify whether an entity should be stored in the second-level cache.
If the `persistence.xml` `shared-cache-mode` XML attribute is set to `ENABLE_SELECTIVE`, then only the entities annotated with the `@Cacheable` are going to be stored in the second-level cache. If the `persistence.xml` `shared-cache-mode` XML attribute is set to `ENABLE_SELECTIVE`, then only the entities annotated with the `@Cacheable` are going to be stored in the second-level cache.
@ -56,102 +56,102 @@ See the <<chapters/caching/Caching.adoc#caching,Caching>> chapter for more info.
[[annotations-jpa-collectiontable]] [[annotations-jpa-collectiontable]]
==== `@CollectionTable` ==== `@CollectionTable`
The http://docs.oracle.com/javaee/7/api/javax/persistence/CollectionTable.html[`@CollectionTable`] annotation is used to specify the database table that stores the values of a basic or an embeddable type collection. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/CollectionTable.html[`@CollectionTable`] annotation is used to specify the database table that stores the values of a basic or an embeddable type collection.
See the <<chapters/domain/embeddables.adoc#embeddable-collections,Collections of embeddable types>> section for more info. See the <<chapters/domain/embeddables.adoc#embeddable-collections,Collections of embeddable types>> section for more info.
[[annotations-jpa-column]] [[annotations-jpa-column]]
==== `@Column` ==== `@Column`
The http://docs.oracle.com/javaee/7/api/javax/persistence/Column.html[`@Column`] annotation is used to specify the mapping between a basic entity attribute and the database table column. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Column.html[`@Column`] annotation is used to specify the mapping between a basic entity attribute and the database table column.
See the <<chapters/domain/basic_types.adoc#basic-column-annotation, `@Column` annotation>> section for more info. See the <<chapters/domain/basic_types.adoc#basic-column-annotation, `@Column` annotation>> section for more info.
[[annotations-jpa-columnresult]] [[annotations-jpa-columnresult]]
==== `@ColumnResult` ==== `@ColumnResult`
The http://docs.oracle.com/javaee/7/api/javax/persistence/ColumnResult.html[`@ColumnResult`] annotation is used in conjunction with the <<annotations-jpa-sqlresultsetmapping>> or <<annotations-jpa-constructorresult>> annotations to map a SQL column for a given SELECT query. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/ColumnResult.html[`@ColumnResult`] annotation is used in conjunction with the <<annotations-jpa-sqlresultsetmapping>> or <<annotations-jpa-constructorresult>> annotations to map a SQL column for a given SELECT query.
See the <<chapters/query/native/Native.adoc#sql-composite-key-entity-associations_named-query-example, Entity associations with named native queries>> section for more info. See the <<chapters/query/native/Native.adoc#sql-composite-key-entity-associations_named-query-example, Entity associations with named native queries>> section for more info.
[[annotations-jpa-constructorresult]] [[annotations-jpa-constructorresult]]
==== `@ConstructorResult` ==== `@ConstructorResult`
The http://docs.oracle.com/javaee/7/api/javax/persistence/ConstructorResult.html[`@ConstructorResult`] annotation is used in conjunction with the <<annotations-jpa-sqlresultsetmapping>> annotations to map columns of a given SELECT query to a certain object constructor. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/ConstructorResult.html[`@ConstructorResult`] annotation is used in conjunction with the <<annotations-jpa-sqlresultsetmapping>> annotations to map columns of a given SELECT query to a certain object constructor.
See the <<chapters/query/native/Native.adoc#sql-multiple-scalar-values-dto-NamedNativeQuery-example, Multiple scalar values `NamedNativeQuery` with `ConstructorResult`>> section for more info. See the <<chapters/query/native/Native.adoc#sql-multiple-scalar-values-dto-NamedNativeQuery-example, Multiple scalar values `NamedNativeQuery` with `ConstructorResult`>> section for more info.
[[annotations-jpa-convert]] [[annotations-jpa-convert]]
==== `@Convert` ==== `@Convert`
The http://docs.oracle.com/javaee/7/api/javax/persistence/Convert.html[`@Convert`] annotation is used to specify the http://docs.oracle.com/javaee/7/api/javax/persistence/AttributeConverter.html[`AttributeConverter`] implementation used to convert the currently annotated basic attribute. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Convert.html[`@Convert`] annotation is used to specify the https://javaee.github.io/javaee-spec/javadocs/javax/persistence/AttributeConverter.html[`AttributeConverter`] implementation used to convert the currently annotated basic attribute.
If the `AttributeConverter` uses http://docs.oracle.com/javaee/7/api/javax/persistence/Converter.html#autoApply--[`autoApply`], then all entity attributes with the same target type are going to be converted automatically. If the `AttributeConverter` uses https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Converter.html#autoApply--[`autoApply`], then all entity attributes with the same target type are going to be converted automatically.
See the <<chapters/domain/basic_types.adoc#basic-enums-attribute-converter, `AttributeConverter`>> section for more info. See the <<chapters/domain/basic_types.adoc#basic-enums-attribute-converter, `AttributeConverter`>> section for more info.
[[annotations-jpa-converter]] [[annotations-jpa-converter]]
==== `@Converter` ==== `@Converter`
The http://docs.oracle.com/javaee/7/api/javax/persistence/Converter.html[`@Converter`] annotation is used to specify that the current annotate http://docs.oracle.com/javaee/7/api/javax/persistence/AttributeConverter.html[`AttributeConverter`] implementation can be used as a JPA basic attribute converter. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Converter.html[`@Converter`] annotation is used to specify that the current annotate https://javaee.github.io/javaee-spec/javadocs/javax/persistence/AttributeConverter.html[`AttributeConverter`] implementation can be used as a JPA basic attribute converter.
If the http://docs.oracle.com/javaee/7/api/javax/persistence/Converter.html#autoApply--[`autoApply`] attribute is set to `true`, then the JPA provider will automatically convert all basic attributes with the same Java type as defined by the current converter. If the https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Converter.html#autoApply--[`autoApply`] attribute is set to `true`, then the JPA provider will automatically convert all basic attributes with the same Java type as defined by the current converter.
See the <<chapters/domain/basic_types.adoc#basic-enums-attribute-converter, `AttributeConverter`>> section for more info. See the <<chapters/domain/basic_types.adoc#basic-enums-attribute-converter, `AttributeConverter`>> section for more info.
[[annotations-jpa-converts]] [[annotations-jpa-converts]]
==== `@Converts` ==== `@Converts`
The http://docs.oracle.com/javaee/7/api/javax/persistence/Converts.html[`@Converts`] annotation is used to group multiple <<annotations-jpa-convert>> annotations. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Converts.html[`@Converts`] annotation is used to group multiple <<annotations-jpa-convert>> annotations.
See the <<chapters/domain/basic_types.adoc#basic-enums-attribute-converter, `AttributeConverter`>> section for more info. See the <<chapters/domain/basic_types.adoc#basic-enums-attribute-converter, `AttributeConverter`>> section for more info.
[[annotations-jpa-discriminatorcolumn]] [[annotations-jpa-discriminatorcolumn]]
==== `@DiscriminatorColumn` ==== `@DiscriminatorColumn`
The http://docs.oracle.com/javaee/7/api/javax/persistence/DiscriminatorColumn.html[`@DiscriminatorColumn`] annotation is used to specify the discriminator column name and the http://docs.oracle.com/javaee/7/api/javax/persistence/DiscriminatorColumn.html#discriminatorType--[discriminator type] for the `SINGLE_TABLE` and `JOINED` Inheritance strategies. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/DiscriminatorColumn.html[`@DiscriminatorColumn`] annotation is used to specify the discriminator column name and the https://javaee.github.io/javaee-spec/javadocs/javax/persistence/DiscriminatorColumn.html#discriminatorType--[discriminator type] for the `SINGLE_TABLE` and `JOINED` Inheritance strategies.
See the <<chapters/domain/inheritance.adoc#entity-inheritance-discriminator, Discriminator>> section for more info. See the <<chapters/domain/inheritance.adoc#entity-inheritance-discriminator, Discriminator>> section for more info.
[[annotations-jpa-discriminatorvalue]] [[annotations-jpa-discriminatorvalue]]
==== `@DiscriminatorValue` ==== `@DiscriminatorValue`
The http://docs.oracle.com/javaee/7/api/javax/persistence/DiscriminatorValue.html[`@DiscriminatorValue`] annotation is used to specify what value of the discriminator column is used for mapping the currently annotated entity. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/DiscriminatorValue.html[`@DiscriminatorValue`] annotation is used to specify what value of the discriminator column is used for mapping the currently annotated entity.
See the <<chapters/domain/inheritance.adoc#entity-inheritance-discriminator, Discriminator>> section for more info. See the <<chapters/domain/inheritance.adoc#entity-inheritance-discriminator, Discriminator>> section for more info.
[[annotations-jpa-elementcollection]] [[annotations-jpa-elementcollection]]
==== `@ElementCollection` ==== `@ElementCollection`
The http://docs.oracle.com/javaee/7/api/javax/persistence/ElementCollection.html[`@ElementCollection`] annotation is used to specify a collection of a basic or embeddable types. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/ElementCollection.html[`@ElementCollection`] annotation is used to specify a collection of a basic or embeddable types.
See the <<chapters/domain/collections.adoc#collections, Collections>> section for more info. See the <<chapters/domain/collections.adoc#collections, Collections>> section for more info.
[[annotations-jpa-embeddable]] [[annotations-jpa-embeddable]]
==== `@Embeddable` ==== `@Embeddable`
The http://docs.oracle.com/javaee/7/api/javax/persistence/Embeddable.html[`@Embeddable`] annotation is used to specify embeddable types. Like basic types, embeddable types do not have any identity, being managed by their owning entity. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Embeddable.html[`@Embeddable`] annotation is used to specify embeddable types. Like basic types, embeddable types do not have any identity, being managed by their owning entity.
See the <<chapters/domain/embeddables.adoc#embeddables, Embeddables>> section for more info. See the <<chapters/domain/embeddables.adoc#embeddables, Embeddables>> section for more info.
[[annotations-jpa-embedded]] [[annotations-jpa-embedded]]
==== `@Embedded` ==== `@Embedded`
The http://docs.oracle.com/javaee/7/api/javax/persistence/Embedded.html[`@Embedded`] annotation is used to specify that a given entity attribute represents an embeddable type. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Embedded.html[`@Embedded`] annotation is used to specify that a given entity attribute represents an embeddable type.
See the <<chapters/domain/embeddables.adoc#embeddables, Embeddables>> section for more info. See the <<chapters/domain/embeddables.adoc#embeddables, Embeddables>> section for more info.
[[annotations-jpa-embeddedid]] [[annotations-jpa-embeddedid]]
==== `@EmbeddedId` ==== `@EmbeddedId`
The http://docs.oracle.com/javaee/7/api/javax/persistence/EmbeddedId.html[`@EmbeddedId`] annotation is used to specify the entity identifier is an embeddable type. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/EmbeddedId.html[`@EmbeddedId`] annotation is used to specify the entity identifier is an embeddable type.
See the <<chapters/domain/identifiers.adoc#identifiers-composite-aggregated, Composite identifiers with `@EmbeddedId`>> section for more info. See the <<chapters/domain/identifiers.adoc#identifiers-composite-aggregated, Composite identifiers with `@EmbeddedId`>> section for more info.
[[annotations-jpa-entity]] [[annotations-jpa-entity]]
==== `@Entity` ==== `@Entity`
The http://docs.oracle.com/javaee/7/api/javax/persistence/Entity.html[`@Entity`] annotation is used to specify that the currently annotate class represents an entity type. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Entity.html[`@Entity`] annotation is used to specify that the currently annotate class represents an entity type.
Unlike basic and embeddable types, entity types have an identity and their state is managed by the underlying Persistence Context. Unlike basic and embeddable types, entity types have an identity and their state is managed by the underlying Persistence Context.
See the <<chapters/domain/entity.adoc#entity, Entity>> section for more info. See the <<chapters/domain/entity.adoc#entity, Entity>> section for more info.
@ -159,49 +159,49 @@ See the <<chapters/domain/entity.adoc#entity, Entity>> section for more info.
[[annotations-jpa-entitylisteners]] [[annotations-jpa-entitylisteners]]
==== `@EntityListeners` ==== `@EntityListeners`
The http://docs.oracle.com/javaee/7/api/javax/persistence/EntityListeners.html[`@EntityListeners`] annotation is used to specify an array of callback listener classes that are used by the currently annotated entity. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/EntityListeners.html[`@EntityListeners`] annotation is used to specify an array of callback listener classes that are used by the currently annotated entity.
See the <<chapters/events/Events.adoc#events-jpa-callbacks-example, JPA callbacks>> section for more info. See the <<chapters/events/Events.adoc#events-jpa-callbacks-example, JPA callbacks>> section for more info.
[[annotations-jpa-entityresult]] [[annotations-jpa-entityresult]]
==== `@EntityResult` ==== `@EntityResult`
The http://docs.oracle.com/javaee/7/api/javax/persistence/EntityResult.html[`@EntityResult`] annotation is used with the <<annotations-jpa-sqlresultsetmapping>> annotation to map the selected columns to an entity. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/EntityResult.html[`@EntityResult`] annotation is used with the <<annotations-jpa-sqlresultsetmapping>> annotation to map the selected columns to an entity.
See the <<chapters/query/native/Native.adoc#sql-composite-key-entity-associations_named-query-example, Entity associations with named native queries>> section for more info. See the <<chapters/query/native/Native.adoc#sql-composite-key-entity-associations_named-query-example, Entity associations with named native queries>> section for more info.
[[annotations-jpa-enumerated]] [[annotations-jpa-enumerated]]
==== `@Enumerated` ==== `@Enumerated`
The http://docs.oracle.com/javaee/7/api/javax/persistence/Enumerated.html[`@Enumerated`] annotation is used to specify that an entity attribute represents an enumerated type. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Enumerated.html[`@Enumerated`] annotation is used to specify that an entity attribute represents an enumerated type.
See the <<chapters/domain/basic_types.adoc#basic-enums-Enumerated, `@Enumerated` basic type>> section for more info. See the <<chapters/domain/basic_types.adoc#basic-enums-Enumerated, `@Enumerated` basic type>> section for more info.
[[annotations-jpa-excludedefaultlisteners]] [[annotations-jpa-excludedefaultlisteners]]
==== `@ExcludeDefaultListeners` ==== `@ExcludeDefaultListeners`
The http://docs.oracle.com/javaee/7/api/javax/persistence/ExcludeDefaultListeners.html[`@ExcludeDefaultListeners`] annotation is used to specify that the currently annotated entity skips the invocation of any default listener. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/ExcludeDefaultListeners.html[`@ExcludeDefaultListeners`] annotation is used to specify that the currently annotated entity skips the invocation of any default listener.
See the <<chapters/events/Events.adoc#events-exclude-default-listener, Exclude default entity listeners>> section for more info. See the <<chapters/events/Events.adoc#events-exclude-default-listener, Exclude default entity listeners>> section for more info.
[[annotations-jpa-excludesuperclasslisteners]] [[annotations-jpa-excludesuperclasslisteners]]
==== `@ExcludeSuperclassListeners` ==== `@ExcludeSuperclassListeners`
The http://docs.oracle.com/javaee/7/api/javax/persistence/ExcludeSuperclassListeners.html[`@ExcludeSuperclassListeners`] annotation is used to specify that the currently annotated entity skips the invocation of listeners declared by its superclass. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/ExcludeSuperclassListeners.html[`@ExcludeSuperclassListeners`] annotation is used to specify that the currently annotated entity skips the invocation of listeners declared by its superclass.
See the <<chapters/events/Events.adoc#events-exclude-default-listener, Exclude default entity listeners>> section for more info. See the <<chapters/events/Events.adoc#events-exclude-default-listener, Exclude default entity listeners>> section for more info.
[[annotations-jpa-fieldresult]] [[annotations-jpa-fieldresult]]
==== `@FieldResult` ==== `@FieldResult`
The http://docs.oracle.com/javaee/7/api/javax/persistence/FieldResult.html[`@FieldResult`] annotation is used with the <<annotations-jpa-entityresult>> annotation to map the selected columns to the fields of some specific entity. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/FieldResult.html[`@FieldResult`] annotation is used with the <<annotations-jpa-entityresult>> annotation to map the selected columns to the fields of some specific entity.
See the <<chapters/query/native/Native.adoc#sql-composite-key-entity-associations_named-query-example, Entity associations with named native queries>> section for more info. See the <<chapters/query/native/Native.adoc#sql-composite-key-entity-associations_named-query-example, Entity associations with named native queries>> section for more info.
[[annotations-jpa-foreignkey]] [[annotations-jpa-foreignkey]]
==== `@ForeignKey` ==== `@ForeignKey`
The http://docs.oracle.com/javaee/7/api/javax/persistence/ForeignKey.html[`@ForeignKey`] annotation is used to specify the associated foreign key of a <<annotations-jpa-joincolumn>> mapping. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/ForeignKey.html[`@ForeignKey`] annotation is used to specify the associated foreign key of a <<annotations-jpa-joincolumn>> mapping.
The `@ForeignKey` annotation is only used if the automated schema generation tool is enabled, in which case, it allows you to customize the underlying foreign key definition. The `@ForeignKey` annotation is only used if the automated schema generation tool is enabled, in which case, it allows you to customize the underlying foreign key definition.
See the <<chapters/domain/associations.adoc#associations-many-to-one-example,`@ManyToOne` with `@ForeignKey`>> section for more info. See the <<chapters/domain/associations.adoc#associations-many-to-one-example,`@ManyToOne` with `@ForeignKey`>> section for more info.
@ -209,7 +209,7 @@ See the <<chapters/domain/associations.adoc#associations-many-to-one-example,`@M
[[annotations-jpa-generatedvalue]] [[annotations-jpa-generatedvalue]]
==== `@GeneratedValue` ==== `@GeneratedValue`
The http://docs.oracle.com/javaee/7/api/javax/persistence/GeneratedValue.html[`@GeneratedValue`] annotation specifies that the entity identifier value is automatically generated using an identity column, a database sequence, or a table generator. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/GeneratedValue.html[`@GeneratedValue`] annotation specifies that the entity identifier value is automatically generated using an identity column, a database sequence, or a table generator.
Hibernate supports the `@GeneratedValue` mapping even for `UUID` identifiers. Hibernate supports the `@GeneratedValue` mapping even for `UUID` identifiers.
See the <<chapters/domain/identifiers.adoc#identifiers-simple-generated,Automatically-generated identifiers>> section for more info. See the <<chapters/domain/identifiers.adoc#identifiers-simple-generated,Automatically-generated identifiers>> section for more info.
@ -217,7 +217,7 @@ See the <<chapters/domain/identifiers.adoc#identifiers-simple-generated,Automati
[[annotations-jpa-id]] [[annotations-jpa-id]]
==== `@Id` ==== `@Id`
The http://docs.oracle.com/javaee/7/api/javax/persistence/Id.html[`@Id`] annotation specifies the entity identifier. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Id.html[`@Id`] annotation specifies the entity identifier.
An entity must always have an identifier attribute which is used when loading the entity in a given Persistence Context. An entity must always have an identifier attribute which is used when loading the entity in a given Persistence Context.
See the <<chapters/domain/identifiers.adoc#identifiers,Identifiers>> section for more info. See the <<chapters/domain/identifiers.adoc#identifiers,Identifiers>> section for more info.
@ -225,7 +225,7 @@ See the <<chapters/domain/identifiers.adoc#identifiers,Identifiers>> section for
[[annotations-jpa-idclass]] [[annotations-jpa-idclass]]
==== `@IdClass` ==== `@IdClass`
The http://docs.oracle.com/javaee/7/api/javax/persistence/IdClass.html[`@IdClass`] annotation is used if the current entity defined a composite identifier. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/IdClass.html[`@IdClass`] annotation is used if the current entity defined a composite identifier.
A separate class encapsulates all the identifier attributes, which are mirrored by the current entity mapping. A separate class encapsulates all the identifier attributes, which are mirrored by the current entity mapping.
See the <<chapters/domain/identifiers.adoc#identifiers-composite-nonaggregated,Composite identifiers with `@IdClass`>> section for more info. See the <<chapters/domain/identifiers.adoc#identifiers-composite-nonaggregated,Composite identifiers with `@IdClass`>> section for more info.
@ -233,89 +233,89 @@ See the <<chapters/domain/identifiers.adoc#identifiers-composite-nonaggregated,C
[[annotations-jpa-index]] [[annotations-jpa-index]]
==== `@Index` ==== `@Index`
The http://docs.oracle.com/javaee/7/api/javax/persistence/Index.html[`@Index`] annotation is used by the automated schema generation tool to create a database index. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Index.html[`@Index`] annotation is used by the automated schema generation tool to create a database index.
See the <<chapters/schema/Schema.adoc#schema-generation-columns-index, Columns index>> chapter for more info. See the <<chapters/schema/Schema.adoc#schema-generation-columns-index, Columns index>> chapter for more info.
[[annotations-jpa-inheritance]] [[annotations-jpa-inheritance]]
==== `@Inheritance` ==== `@Inheritance`
The http://docs.oracle.com/javaee/7/api/javax/persistence/Inheritance.html[`@Inheritance`] annotation is used to specify the inheritance strategy of a given entity class hierarchy. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Inheritance.html[`@Inheritance`] annotation is used to specify the inheritance strategy of a given entity class hierarchy.
See the <<chapters/domain/inheritance.adoc#entity-inheritance,Inheritance>> section for more info. See the <<chapters/domain/inheritance.adoc#entity-inheritance,Inheritance>> section for more info.
[[annotations-jpa-joincolumn]] [[annotations-jpa-joincolumn]]
==== `@JoinColumn` ==== `@JoinColumn`
The http://docs.oracle.com/javaee/7/api/javax/persistence/JoinColumn.html[`@JoinColumn`] annotation is used to specify the FOREIGN KEY column used when joining an entity association or an embeddable collection. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/JoinColumn.html[`@JoinColumn`] annotation is used to specify the FOREIGN KEY column used when joining an entity association or an embeddable collection.
See the <<chapters/domain/associations.adoc#associations-many-to-one-example,`@ManyToOne` with `@JoinColumn`>> section for more info. See the <<chapters/domain/associations.adoc#associations-many-to-one-example,`@ManyToOne` with `@JoinColumn`>> section for more info.
[[annotations-jpa-joincolumns]] [[annotations-jpa-joincolumns]]
==== `@JoinColumns` ==== `@JoinColumns`
The http://docs.oracle.com/javaee/7/api/javax/persistence/JoinColumns.html[`@JoinColumns`] annotation is used to group multiple <<annotations-jpa-joincolumn>> annotations, which are used when mapping entity association or an embeddable collection using a composite identifier The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/JoinColumns.html[`@JoinColumns`] annotation is used to group multiple <<annotations-jpa-joincolumn>> annotations, which are used when mapping entity association or an embeddable collection using a composite identifier
[[annotations-jpa-jointable]] [[annotations-jpa-jointable]]
==== `@JoinTable` ==== `@JoinTable`
The http://docs.oracle.com/javaee/7/api/javax/persistence/JoinTable.html[`@JoinTable`] annotation is used to specify the link table between two other database tables. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/JoinTable.html[`@JoinTable`] annotation is used to specify the link table between two other database tables.
See the <<chapters/domain/collections.adoc#collections-map-unidirectional-example, `@JoinTable` mapping>> section for more info. See the <<chapters/domain/collections.adoc#collections-map-unidirectional-example, `@JoinTable` mapping>> section for more info.
[[annotations-jpa-lob]] [[annotations-jpa-lob]]
==== `@Lob` ==== `@Lob`
The http://docs.oracle.com/javaee/7/api/javax/persistence/Lob.html[`@Lob`] annotation is used to specify that the currently annotated entity attribute represents a large object type. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Lob.html[`@Lob`] annotation is used to specify that the currently annotated entity attribute represents a large object type.
See the <<chapters/domain/basic_types.adoc#basic-blob-example, `BLOB` mapping>> section for more info. See the <<chapters/domain/basic_types.adoc#basic-blob-example, `BLOB` mapping>> section for more info.
[[annotations-jpa-manytomany]] [[annotations-jpa-manytomany]]
==== `@ManyToMany` ==== `@ManyToMany`
The http://docs.oracle.com/javaee/7/api/javax/persistence/ManyToMany.html[`@ManyToMany`] annotation is used to specify a many-to-many database relationship. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/ManyToMany.html[`@ManyToMany`] annotation is used to specify a many-to-many database relationship.
See the <<chapters/domain/associations.adoc#associations-many-to-many, `@ManyToMany` mapping>> section for more info. See the <<chapters/domain/associations.adoc#associations-many-to-many, `@ManyToMany` mapping>> section for more info.
[[annotations-jpa-manytoone]] [[annotations-jpa-manytoone]]
==== `@ManyToOne` ==== `@ManyToOne`
The http://docs.oracle.com/javaee/7/api/javax/persistence/ManyToOne.html[`@ManyToOne`] annotation is used to specify a many-to-one database relationship. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/ManyToOne.html[`@ManyToOne`] annotation is used to specify a many-to-one database relationship.
See the <<chapters/domain/associations.adoc#associations-many-to-one, `@ManyToOne` mapping>> section for more info. See the <<chapters/domain/associations.adoc#associations-many-to-one, `@ManyToOne` mapping>> section for more info.
[[annotations-jpa-mapkey]] [[annotations-jpa-mapkey]]
==== `@MapKey` ==== `@MapKey`
The http://docs.oracle.com/javaee/7/api/javax/persistence/MapKey.html[`@MapKey`] annotation is used to specify the key of a `java.util.Map` association for which the key type is either the primary key or an attribute of the entity which represents the value of the map. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/MapKey.html[`@MapKey`] annotation is used to specify the key of a `java.util.Map` association for which the key type is either the primary key or an attribute of the entity which represents the value of the map.
See the <<chapters/domain/collections.adoc#collections-map-unidirectional-example, `@MapKey` mapping>> section for more info. See the <<chapters/domain/collections.adoc#collections-map-unidirectional-example, `@MapKey` mapping>> section for more info.
[[annotations-jpa-mapkeyclass]] [[annotations-jpa-mapkeyclass]]
==== `@MapKeyClass` ==== `@MapKeyClass`
The http://docs.oracle.com/javaee/7/api/javax/persistence/MapKeyClass.html[`@MapKeyClass`] annotation is used to specify the type of the map key of a `java.util.Map` associations. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/MapKeyClass.html[`@MapKeyClass`] annotation is used to specify the type of the map key of a `java.util.Map` associations.
See the <<chapters/domain/collections.adoc#collections-map-key-class, `@MapKeyClass` mapping>> section for more info. See the <<chapters/domain/collections.adoc#collections-map-key-class, `@MapKeyClass` mapping>> section for more info.
[[annotations-jpa-mapkeycolumn]] [[annotations-jpa-mapkeycolumn]]
==== `@MapKeyColumn` ==== `@MapKeyColumn`
The http://docs.oracle.com/javaee/7/api/javax/persistence/MapKeyColumn.html[`@MapKeyColumn`] annotation is used to specify the database column which stores the key of a `java.util.Map` association for which the map key is a basic type. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/MapKeyColumn.html[`@MapKeyColumn`] annotation is used to specify the database column which stores the key of a `java.util.Map` association for which the map key is a basic type.
See the <<chapters/domain/collections.adoc#collections-map-custom-key-type-mapping-example, `@MapKeyType` mapping section>> for an example of `@MapKeyColumn` annotation usage. See the <<chapters/domain/collections.adoc#collections-map-custom-key-type-mapping-example, `@MapKeyType` mapping section>> for an example of `@MapKeyColumn` annotation usage.
[[annotations-jpa-mapkeyenumerated]] [[annotations-jpa-mapkeyenumerated]]
==== `@MapKeyEnumerated` ==== `@MapKeyEnumerated`
The http://docs.oracle.com/javaee/7/api/javax/persistence/MapKeyEnumerated.html[`@MapKeyEnumerated`] annotation is used to specify that the key of `java.util.Map` association is a Java Enum. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/MapKeyEnumerated.html[`@MapKeyEnumerated`] annotation is used to specify that the key of `java.util.Map` association is a Java Enum.
See the <<chapters/domain/collections.adoc#collections-map-bidirectional-example, `@MapKeyEnumerated` mapping>> section for more info. See the <<chapters/domain/collections.adoc#collections-map-bidirectional-example, `@MapKeyEnumerated` mapping>> section for more info.
[[annotations-jpa-mapkeyjoincolumn]] [[annotations-jpa-mapkeyjoincolumn]]
==== `@MapKeyJoinColumn` ==== `@MapKeyJoinColumn`
The http://docs.oracle.com/javaee/7/api/javax/persistence/MapKeyJoinColumn.html[`@MapKeyJoinColumn`] annotation is used to specify that the key of `java.util.Map` association is an entity association. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/MapKeyJoinColumn.html[`@MapKeyJoinColumn`] annotation is used to specify that the key of `java.util.Map` association is an entity association.
The map key column is a FOREIGN KEY in a link table that also joins the `Map` owner's table with the table where the `Map` value resides. The map key column is a FOREIGN KEY in a link table that also joins the `Map` owner's table with the table where the `Map` value resides.
See the <<chapters/domain/collections.adoc#collections-map-value-type-entity-key-example, `@MapKeyJoinColumn` mapping>> section for more info. See the <<chapters/domain/collections.adoc#collections-map-value-type-entity-key-example, `@MapKeyJoinColumn` mapping>> section for more info.
@ -323,205 +323,205 @@ See the <<chapters/domain/collections.adoc#collections-map-value-type-entity-key
[[annotations-jpa-mapkeyjoincolumns]] [[annotations-jpa-mapkeyjoincolumns]]
==== `@MapKeyJoinColumns` ==== `@MapKeyJoinColumns`
The http://docs.oracle.com/javaee/7/api/javax/persistence/MapKeyJoinColumns.html[`@MapKeyJoinColumns`] annotation is used to group several <<annotations-jpa-mapkeyjoincolumn>> mappings when the `java.util.Map` association key uses a composite identifier. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/MapKeyJoinColumns.html[`@MapKeyJoinColumns`] annotation is used to group several <<annotations-jpa-mapkeyjoincolumn>> mappings when the `java.util.Map` association key uses a composite identifier.
[[annotations-jpa-mapkeytemporal]] [[annotations-jpa-mapkeytemporal]]
==== `@MapKeyTemporal` ==== `@MapKeyTemporal`
The http://docs.oracle.com/javaee/7/api/javax/persistence/MapKeyTemporal.html[`@MapKeyTemporal`] annotation is used to specify that the key of `java.util.Map` association is a http://docs.oracle.com/javaee/7/api/javax/persistence/TemporalType.html[`@TemporalType`] (e.g. `DATE`, `TIME`, `TIMESTAMP`). The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/MapKeyTemporal.html[`@MapKeyTemporal`] annotation is used to specify that the key of `java.util.Map` association is a https://javaee.github.io/javaee-spec/javadocs/javax/persistence/TemporalType.html[`@TemporalType`] (e.g. `DATE`, `TIME`, `TIMESTAMP`).
See the <<chapters/domain/collections.adoc#collections-map-unidirectional-example, `@MapKeyTemporal` mapping>> section for more info. See the <<chapters/domain/collections.adoc#collections-map-unidirectional-example, `@MapKeyTemporal` mapping>> section for more info.
[[annotations-jpa-mappedsuperclass]] [[annotations-jpa-mappedsuperclass]]
==== `@MappedSuperclass` ==== `@MappedSuperclass`
The http://docs.oracle.com/javaee/7/api/javax/persistence/MappedSuperclass.html[`@MappedSuperclass`] annotation is used to specify that the currently annotated type attributes are inherited by any subclass entity. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/MappedSuperclass.html[`@MappedSuperclass`] annotation is used to specify that the currently annotated type attributes are inherited by any subclass entity.
See the <<chapters/domain/inheritance.adoc#entity-inheritance-mapped-superclass, `@MappedSuperclass`>> section for more info. See the <<chapters/domain/inheritance.adoc#entity-inheritance-mapped-superclass, `@MappedSuperclass`>> section for more info.
[[annotations-jpa-mapsid]] [[annotations-jpa-mapsid]]
==== `@MapsId` ==== `@MapsId`
The http://docs.oracle.com/javaee/7/api/javax/persistence/MapsId.html[`@MapsId`] annotation is used to specify that the entity identifier is mapped by the currently annotated `@ManyToOne` or `@OneToOne` association. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/MapsId.html[`@MapsId`] annotation is used to specify that the entity identifier is mapped by the currently annotated `@ManyToOne` or `@OneToOne` association.
See the <<chapters/domain/identifiers.adoc#identifiers-derived-mapsid, `@MapsId` mapping>> section for more info. See the <<chapters/domain/identifiers.adoc#identifiers-derived-mapsid, `@MapsId` mapping>> section for more info.
[[annotations-jpa-namedattributenode]] [[annotations-jpa-namedattributenode]]
==== `@NamedAttributeNode` ==== `@NamedAttributeNode`
The http://docs.oracle.com/javaee/7/api/javax/persistence/NamedAttributeNode.html[`@NamedAttributeNode`] annotation is used to specify each individual attribute node that needs to be fetched by an Entity Graph. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/NamedAttributeNode.html[`@NamedAttributeNode`] annotation is used to specify each individual attribute node that needs to be fetched by an Entity Graph.
See the <<chapters/fetching/Fetching.adoc#fetching-strategies-dynamic-fetching-entity-graph-example, Fetch graph>> section for more info. See the <<chapters/fetching/Fetching.adoc#fetching-strategies-dynamic-fetching-entity-graph-example, Fetch graph>> section for more info.
[[annotations-jpa-namedentitygraph]] [[annotations-jpa-namedentitygraph]]
==== `@NamedEntityGraph` ==== `@NamedEntityGraph`
The http://docs.oracle.com/javaee/7/api/javax/persistence/NamedEntityGraph.html[`@NamedEntityGraph`] annotation is used to specify an Entity Graph that can be used by an entity query to override the default fetch plan. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/NamedEntityGraph.html[`@NamedEntityGraph`] annotation is used to specify an Entity Graph that can be used by an entity query to override the default fetch plan.
See the <<chapters/fetching/Fetching.adoc#fetching-strategies-dynamic-fetching-entity-graph-example, Fetch graph>> section for more info. See the <<chapters/fetching/Fetching.adoc#fetching-strategies-dynamic-fetching-entity-graph-example, Fetch graph>> section for more info.
[[annotations-jpa-namedentitygraphs]] [[annotations-jpa-namedentitygraphs]]
==== `@NamedEntityGraphs` ==== `@NamedEntityGraphs`
The http://docs.oracle.com/javaee/7/api/javax/persistence/NamedEntityGraphs.html[`@NamedEntityGraphs`] annotation is used to group multiple <<annotations-jpa-namedentitygraph>> annotations. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/NamedEntityGraphs.html[`@NamedEntityGraphs`] annotation is used to group multiple <<annotations-jpa-namedentitygraph>> annotations.
[[annotations-jpa-namednativequeries]] [[annotations-jpa-namednativequeries]]
==== `@NamedNativeQueries` ==== `@NamedNativeQueries`
The http://docs.oracle.com/javaee/7/api/javax/persistence/NamedNativeQueries.html[`@NamedNativeQueries`] annotation is used to group multiple <<annotations-jpa-namednativequery>> annotations. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/NamedNativeQueries.html[`@NamedNativeQueries`] annotation is used to group multiple <<annotations-jpa-namednativequery>> annotations.
See the <<chapters/query/native/Native.adoc#sql-custom-crud-example, Custom CRUD mapping>> section for more info. See the <<chapters/query/native/Native.adoc#sql-custom-crud-example, Custom CRUD mapping>> section for more info.
[[annotations-jpa-namednativequery]] [[annotations-jpa-namednativequery]]
==== `@NamedNativeQuery` ==== `@NamedNativeQuery`
The http://docs.oracle.com/javaee/7/api/javax/persistence/NamedNativeQuery.html[`@NamedNativeQuery`] annotation is used to specify a native SQL query that can be retrieved later by its name. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/NamedNativeQuery.html[`@NamedNativeQuery`] annotation is used to specify a native SQL query that can be retrieved later by its name.
See the <<chapters/query/native/Native.adoc#sql-custom-crud-example, Custom CRUD mapping>> section for more info. See the <<chapters/query/native/Native.adoc#sql-custom-crud-example, Custom CRUD mapping>> section for more info.
[[annotations-jpa-namedqueries]] [[annotations-jpa-namedqueries]]
==== `@NamedQueries` ==== `@NamedQueries`
The http://docs.oracle.com/javaee/7/api/javax/persistence/NamedQueries.html[`@NamedQueries`] annotation is used to group multiple <<annotations-jpa-namedquery>> annotations. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/NamedQueries.html[`@NamedQueries`] annotation is used to group multiple <<annotations-jpa-namedquery>> annotations.
[[annotations-jpa-namedquery]] [[annotations-jpa-namedquery]]
==== `@NamedQuery` ==== `@NamedQuery`
The http://docs.oracle.com/javaee/7/api/javax/persistence/NamedQuery.html[`@NamedQuery`] annotation is used to specify a JPQL query that can be retrieved later by its name. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/NamedQuery.html[`@NamedQuery`] annotation is used to specify a JPQL query that can be retrieved later by its name.
See the <<chapters/query/hql/HQL.adoc#jpql-api-named-query-example, `@NamedQuery`>> section for more info. See the <<chapters/query/hql/HQL.adoc#jpql-api-named-query-example, `@NamedQuery`>> section for more info.
[[annotations-jpa-namedstoredprocedurequeries]] [[annotations-jpa-namedstoredprocedurequeries]]
==== `@NamedStoredProcedureQueries` ==== `@NamedStoredProcedureQueries`
The http://docs.oracle.com/javaee/7/api/javax/persistence/NamedStoredProcedureQueries.html[`@NamedStoredProcedureQueries`] annotation is used to group multiple <<annotations-jpa-namedstoredprocedurequery>> annotations. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/NamedStoredProcedureQueries.html[`@NamedStoredProcedureQueries`] annotation is used to group multiple <<annotations-jpa-namedstoredprocedurequery>> annotations.
[[annotations-jpa-namedstoredprocedurequery]] [[annotations-jpa-namedstoredprocedurequery]]
==== `@NamedStoredProcedureQuery` ==== `@NamedStoredProcedureQuery`
The http://docs.oracle.com/javaee/7/api/javax/persistence/NamedStoredProcedureQuery.html[`@NamedStoredProcedureQuery`] annotation is used to specify a stored procedure query that can be retrieved later by its name. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/NamedStoredProcedureQuery.html[`@NamedStoredProcedureQuery`] annotation is used to specify a stored procedure query that can be retrieved later by its name.
See the <<chapters/query/native/Native.adoc#sql-sp-named-query, Using named queries to call stored procedures>> section for more info. See the <<chapters/query/native/Native.adoc#sql-sp-named-query, Using named queries to call stored procedures>> section for more info.
[[annotations-jpa-namedsubgraph]] [[annotations-jpa-namedsubgraph]]
==== `@NamedSubgraph` ==== `@NamedSubgraph`
The http://docs.oracle.com/javaee/7/api/javax/persistence/NamedSubgraph.html[`@NamedSubgraph`] annotation used to specify a subgraph in an Entity Graph. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/NamedSubgraph.html[`@NamedSubgraph`] annotation used to specify a subgraph in an Entity Graph.
See the <<chapters/fetching/Fetching.adoc#fetching-strategies-dynamic-fetching-entity-subgraph, Fetch subgraph>> section for more info. See the <<chapters/fetching/Fetching.adoc#fetching-strategies-dynamic-fetching-entity-subgraph, Fetch subgraph>> section for more info.
[[annotations-jpa-onetomany]] [[annotations-jpa-onetomany]]
==== `@OneToMany` ==== `@OneToMany`
The http://docs.oracle.com/javaee/7/api/javax/persistence/OneToMany.html[`@OneToMany`] annotation is used to specify a one-to-many database relationship. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/OneToMany.html[`@OneToMany`] annotation is used to specify a one-to-many database relationship.
See the <<chapters/domain/associations.adoc#associations-one-to-many, `@OneToMany` mapping>> section for more info. See the <<chapters/domain/associations.adoc#associations-one-to-many, `@OneToMany` mapping>> section for more info.
[[annotations-jpa-onetoone]] [[annotations-jpa-onetoone]]
==== `@OneToOne` ==== `@OneToOne`
The http://docs.oracle.com/javaee/7/api/javax/persistence/OneToOne.html[`@OneToOne`] annotation is used to specify a one-to-one database relationship. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/OneToOne.html[`@OneToOne`] annotation is used to specify a one-to-one database relationship.
See the <<chapters/domain/associations.adoc#associations-one-to-one, `@OneToOne` mapping>> section for more info. See the <<chapters/domain/associations.adoc#associations-one-to-one, `@OneToOne` mapping>> section for more info.
[[annotations-jpa-orderby]] [[annotations-jpa-orderby]]
==== `@OrderBy` ==== `@OrderBy`
The http://docs.oracle.com/javaee/7/api/javax/persistence/OrderBy.html[`@OrderBy`] annotation is used to specify the entity attributes used for sorting when fetching the currently annotated collection. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/OrderBy.html[`@OrderBy`] annotation is used to specify the entity attributes used for sorting when fetching the currently annotated collection.
See the <<chapters/domain/collections.adoc#collections-unidirectional-ordered-list, `@OrderBy` mapping>> section for more info. See the <<chapters/domain/collections.adoc#collections-unidirectional-ordered-list, `@OrderBy` mapping>> section for more info.
[[annotations-jpa-ordercolumn]] [[annotations-jpa-ordercolumn]]
==== `@OrderColumn` ==== `@OrderColumn`
The http://docs.oracle.com/javaee/7/api/javax/persistence/OrderColumn.html[`@OrderColumn`] annotation is used to specify that the current annotation collection order should be materialized in the database. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/OrderColumn.html[`@OrderColumn`] annotation is used to specify that the current annotation collection order should be materialized in the database.
See the <<chapters/domain/collections.adoc#collections-unidirectional-ordered-list-order-column-example, `@OrderColumn` mapping>> section for more info. See the <<chapters/domain/collections.adoc#collections-unidirectional-ordered-list-order-column-example, `@OrderColumn` mapping>> section for more info.
[[annotations-jpa-persistencecontext]] [[annotations-jpa-persistencecontext]]
==== `@PersistenceContext` ==== `@PersistenceContext`
The http://docs.oracle.com/javaee/7/api/javax/persistence/PersistenceContext.html[`@PersistenceContext`] annotation is used to specify the `EntityManager` that needs to be injected as a dependency. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/PersistenceContext.html[`@PersistenceContext`] annotation is used to specify the `EntityManager` that needs to be injected as a dependency.
See the <<chapters/bootstrap/Bootstrap.adoc#bootstrap-jpa-compliant-PersistenceContext-example, `@PersistenceContext` mapping>> section for more info. See the <<chapters/bootstrap/Bootstrap.adoc#bootstrap-jpa-compliant-PersistenceContext-example, `@PersistenceContext` mapping>> section for more info.
[[annotations-jpa-persistencecontexts]] [[annotations-jpa-persistencecontexts]]
==== `@PersistenceContexts` ==== `@PersistenceContexts`
The http://docs.oracle.com/javaee/7/api/javax/persistence/PersistenceContexts.html[`@PersistenceContexts`] annotation is used to group multiple <<annotations-jpa-persistencecontext>> annotations. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/PersistenceContexts.html[`@PersistenceContexts`] annotation is used to group multiple <<annotations-jpa-persistencecontext>> annotations.
[[annotations-jpa-persistenceproperty]] [[annotations-jpa-persistenceproperty]]
==== `@PersistenceProperty` ==== `@PersistenceProperty`
The http://docs.oracle.com/javaee/7/api/javax/persistence/PersistenceProperty.html[`@PersistenceProperty`] annotation is used by the <<annotations-jpa-persistencecontext>> annotation to declare JPA provider properties that are passed to the underlying container when the `EntityManager` instance is created. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/PersistenceProperty.html[`@PersistenceProperty`] annotation is used by the <<annotations-jpa-persistencecontext>> annotation to declare JPA provider properties that are passed to the underlying container when the `EntityManager` instance is created.
See the <<chapters/bootstrap/Bootstrap.adoc#bootstrap-jpa-compliant-PersistenceContext-configurable-example, `@PersistenceProperty` mapping>> section for more info. See the <<chapters/bootstrap/Bootstrap.adoc#bootstrap-jpa-compliant-PersistenceContext-configurable-example, `@PersistenceProperty` mapping>> section for more info.
[[annotations-jpa-persistenceunit]] [[annotations-jpa-persistenceunit]]
==== `@PersistenceUnit` ==== `@PersistenceUnit`
The http://docs.oracle.com/javaee/7/api/javax/persistence/PersistenceUnit.html[`@PersistenceUnit`] annotation is used to specify the `EntityManagerFactory` that needs to be injected as a dependency. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/PersistenceUnit.html[`@PersistenceUnit`] annotation is used to specify the `EntityManagerFactory` that needs to be injected as a dependency.
See the <<chapters/bootstrap/Bootstrap.adoc#bootstrap-jpa-compliant-PersistenceUnit-example, `@PersistenceUnit` mapping>> section for more info. See the <<chapters/bootstrap/Bootstrap.adoc#bootstrap-jpa-compliant-PersistenceUnit-example, `@PersistenceUnit` mapping>> section for more info.
[[annotations-jpa-persistenceunits]] [[annotations-jpa-persistenceunits]]
==== `@PersistenceUnits` ==== `@PersistenceUnits`
The http://docs.oracle.com/javaee/7/api/javax/persistence/PersistenceUnits.html[`@PersistenceUnits`] annotation is used to group multiple <<annotations-jpa-persistenceunit>> annotations. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/PersistenceUnits.html[`@PersistenceUnits`] annotation is used to group multiple <<annotations-jpa-persistenceunit>> annotations.
[[annotations-jpa-postload]] [[annotations-jpa-postload]]
==== `@PostLoad` ==== `@PostLoad`
The http://docs.oracle.com/javaee/7/api/javax/persistence/PostLoad.html[`@PostLoad`] annotation is used to specify a callback method that fires after an entity is loaded. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/PostLoad.html[`@PostLoad`] annotation is used to specify a callback method that fires after an entity is loaded.
See the <<chapters/events/Events.adoc#events-jpa-callbacks-example, JPA callbacks>> section for more info. See the <<chapters/events/Events.adoc#events-jpa-callbacks-example, JPA callbacks>> section for more info.
[[annotations-jpa-postpersist]] [[annotations-jpa-postpersist]]
==== `@PostPersist` ==== `@PostPersist`
The http://docs.oracle.com/javaee/7/api/javax/persistence/PostPersist.html[`@PostPersist`] annotation is used to specify a callback method that fires after an entity is persisted. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/PostPersist.html[`@PostPersist`] annotation is used to specify a callback method that fires after an entity is persisted.
See the <<chapters/events/Events.adoc#events-jpa-callbacks-example, JPA callbacks>> section for more info. See the <<chapters/events/Events.adoc#events-jpa-callbacks-example, JPA callbacks>> section for more info.
[[annotations-jpa-postremove]] [[annotations-jpa-postremove]]
==== `@PostRemove` ==== `@PostRemove`
The http://docs.oracle.com/javaee/7/api/javax/persistence/PostRemove.html[`@PostRemove`] annotation is used to specify a callback method that fires after an entity is removed. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/PostRemove.html[`@PostRemove`] annotation is used to specify a callback method that fires after an entity is removed.
See the <<chapters/events/Events.adoc#events-jpa-callbacks-example, JPA callbacks>> section for more info. See the <<chapters/events/Events.adoc#events-jpa-callbacks-example, JPA callbacks>> section for more info.
[[annotations-jpa-postupdate]] [[annotations-jpa-postupdate]]
==== `@PostUpdate` ==== `@PostUpdate`
The http://docs.oracle.com/javaee/7/api/javax/persistence/PostUpdate.html[`@PostUpdate`] annotation is used to specify a callback method that fires after an entity is updated. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/PostUpdate.html[`@PostUpdate`] annotation is used to specify a callback method that fires after an entity is updated.
See the <<chapters/events/Events.adoc#events-jpa-callbacks-example, JPA callbacks>> section for more info. See the <<chapters/events/Events.adoc#events-jpa-callbacks-example, JPA callbacks>> section for more info.
[[annotations-jpa-prepersist]] [[annotations-jpa-prepersist]]
==== `@PrePersist` ==== `@PrePersist`
The http://docs.oracle.com/javaee/7/api/javax/persistence/PrePersist.html[`@PrePersist`] annotation is used to specify a callback method that fires before an entity is persisted. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/PrePersist.html[`@PrePersist`] annotation is used to specify a callback method that fires before an entity is persisted.
See the <<chapters/events/Events.adoc#events-jpa-callbacks-example, JPA callbacks>> section for more info. See the <<chapters/events/Events.adoc#events-jpa-callbacks-example, JPA callbacks>> section for more info.
[[annotations-jpa-preremove]] [[annotations-jpa-preremove]]
==== `@PreRemove` ==== `@PreRemove`
The http://docs.oracle.com/javaee/7/api/javax/persistence/PreRemove.html[`@PreRemove`] annotation is used to specify a callback method that fires before an entity is removed. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/PreRemove.html[`@PreRemove`] annotation is used to specify a callback method that fires before an entity is removed.
See the <<chapters/events/Events.adoc#events-jpa-callbacks-example, JPA callbacks>> section for more info. See the <<chapters/events/Events.adoc#events-jpa-callbacks-example, JPA callbacks>> section for more info.
[[annotations-jpa-preupdate]] [[annotations-jpa-preupdate]]
==== `@PreUpdate` ==== `@PreUpdate`
The http://docs.oracle.com/javaee/7/api/javax/persistence/PreUpdate.html[`@PreUpdate`] annotation is used to specify a callback method that fires before an entity is updated. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/PreUpdate.html[`@PreUpdate`] annotation is used to specify a callback method that fires before an entity is updated.
See the <<chapters/events/Events.adoc#events-jpa-callbacks-example, JPA callbacks>> section for more info. See the <<chapters/events/Events.adoc#events-jpa-callbacks-example, JPA callbacks>> section for more info.
[[annotations-jpa-primarykeyjoincolumn]] [[annotations-jpa-primarykeyjoincolumn]]
==== `@PrimaryKeyJoinColumn` ==== `@PrimaryKeyJoinColumn`
The http://docs.oracle.com/javaee/7/api/javax/persistence/PrimaryKeyJoinColumn.html[`@PrimaryKeyJoinColumn`] annotation is used to specify that the primary key column of the currently annotated entity is also a foreign key to some other entity The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/PrimaryKeyJoinColumn.html[`@PrimaryKeyJoinColumn`] annotation is used to specify that the primary key column of the currently annotated entity is also a foreign key to some other entity
(e.g. a base class table in a `JOINED` inheritance strategy, the primary table in a secondary table mapping, or the parent table in a `@OneToOne` relationship). (e.g. a base class table in a `JOINED` inheritance strategy, the primary table in a secondary table mapping, or the parent table in a `@OneToOne` relationship).
See the <<chapters/domain/identifiers.adoc#identifiers-derived-primarykeyjoincolumn, `@PrimaryKeyJoinColumn` mapping>> section for more info. See the <<chapters/domain/identifiers.adoc#identifiers-derived-primarykeyjoincolumn, `@PrimaryKeyJoinColumn` mapping>> section for more info.
@ -529,92 +529,92 @@ See the <<chapters/domain/identifiers.adoc#identifiers-derived-primarykeyjoincol
[[annotations-jpa-primarykeyjoincolumns]] [[annotations-jpa-primarykeyjoincolumns]]
==== `@PrimaryKeyJoinColumns` ==== `@PrimaryKeyJoinColumns`
The http://docs.oracle.com/javaee/7/api/javax/persistence/PrimaryKeyJoinColumns.html[`@PrimaryKeyJoinColumns`] annotation is used to group multiple <<annotations-jpa-primarykeyjoincolumn>> annotations. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/PrimaryKeyJoinColumns.html[`@PrimaryKeyJoinColumns`] annotation is used to group multiple <<annotations-jpa-primarykeyjoincolumn>> annotations.
[[annotations-jpa-queryhint]] [[annotations-jpa-queryhint]]
==== `@QueryHint` ==== `@QueryHint`
The http://docs.oracle.com/javaee/7/api/javax/persistence/QueryHint.html[`@QueryHint`] annotation is used to specify a JPA provider hint used by a `@NamedQuery` or a `@NamedNativeQuery` annotation. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/QueryHint.html[`@QueryHint`] annotation is used to specify a JPA provider hint used by a `@NamedQuery` or a `@NamedNativeQuery` annotation.
See the <<chapters/query/hql/HQL.adoc#jpa-read-only-entities-native-example, `@QueryHint`>> section for more info. See the <<chapters/query/hql/HQL.adoc#jpa-read-only-entities-native-example, `@QueryHint`>> section for more info.
[[annotations-jpa-secondarytable]] [[annotations-jpa-secondarytable]]
==== `@SecondaryTable` ==== `@SecondaryTable`
The http://docs.oracle.com/javaee/7/api/javax/persistence/SecondaryTable.html[`@SecondaryTable`] annotation is used to specify a secondary table for the currently annotated entity. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/SecondaryTable.html[`@SecondaryTable`] annotation is used to specify a secondary table for the currently annotated entity.
See the <<chapters/query/native/Native.adoc#sql-custom-crud-secondary-table-example, `@SecondaryTable` mapping>> section for more info. See the <<chapters/query/native/Native.adoc#sql-custom-crud-secondary-table-example, `@SecondaryTable` mapping>> section for more info.
[[annotations-jpa-secondarytables]] [[annotations-jpa-secondarytables]]
==== `@SecondaryTables` ==== `@SecondaryTables`
The http://docs.oracle.com/javaee/7/api/javax/persistence/SecondaryTables.html[`@SecondaryTables`] annotation is used to group multiple <<annotations-jpa-secondarytable>> annotations. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/SecondaryTables.html[`@SecondaryTables`] annotation is used to group multiple <<annotations-jpa-secondarytable>> annotations.
[[annotations-jpa-sequencegenerator]] [[annotations-jpa-sequencegenerator]]
==== `@SequenceGenerator` ==== `@SequenceGenerator`
The http://docs.oracle.com/javaee/7/api/javax/persistence/SequenceGenerator.html[`@SequenceGenerator`] annotation is used to specify the database sequence used by the identifier generator of the currently annotated entity. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/SequenceGenerator.html[`@SequenceGenerator`] annotation is used to specify the database sequence used by the identifier generator of the currently annotated entity.
See the <<chapters/domain/identifiers.adoc#identifiers-generators-sequence-configured,`@SequenceGenerator` mapping>> section for more info. See the <<chapters/domain/identifiers.adoc#identifiers-generators-sequence-configured,`@SequenceGenerator` mapping>> section for more info.
[[annotations-jpa-sqlresultsetmapping]] [[annotations-jpa-sqlresultsetmapping]]
==== `@SqlResultSetMapping` ==== `@SqlResultSetMapping`
The http://docs.oracle.com/javaee/7/api/javax/persistence/SqlResultSetMapping.html[`@SqlResultSetMapping`] annotation is used to specify the `ResultSet` mapping of a native SQL query or stored procedure. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/SqlResultSetMapping.html[`@SqlResultSetMapping`] annotation is used to specify the `ResultSet` mapping of a native SQL query or stored procedure.
See the <<chapters/query/native/Native.adoc#sql-composite-key-entity-associations_named-query-example, `SqlResultSetMapping` mapping>> section for more info. See the <<chapters/query/native/Native.adoc#sql-composite-key-entity-associations_named-query-example, `SqlResultSetMapping` mapping>> section for more info.
[[annotations-jpa-sqlresultsetmappings]] [[annotations-jpa-sqlresultsetmappings]]
==== `@SqlResultSetMappings` ==== `@SqlResultSetMappings`
The http://docs.oracle.com/javaee/7/api/javax/persistence/SqlResultSetMappings.html[`@SqlResultSetMappings`] annotation is group multiple <<annotations-jpa-sqlresultsetmapping>> annotations. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/SqlResultSetMappings.html[`@SqlResultSetMappings`] annotation is group multiple <<annotations-jpa-sqlresultsetmapping>> annotations.
[[annotations-jpa-storedprocedureparameter]] [[annotations-jpa-storedprocedureparameter]]
==== `@StoredProcedureParameter` ==== `@StoredProcedureParameter`
The http://docs.oracle.com/javaee/7/api/javax/persistence/StoredProcedureParameter.html[`@StoredProcedureParameter`] annotation is used to specify a parameter of a <<annotations-jpa-namedstoredprocedurequery>>. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/StoredProcedureParameter.html[`@StoredProcedureParameter`] annotation is used to specify a parameter of a <<annotations-jpa-namedstoredprocedurequery>>.
See the <<chapters/query/native/Native.adoc#sql-sp-named-query, Using named queries to call stored procedures>> section for more info. See the <<chapters/query/native/Native.adoc#sql-sp-named-query, Using named queries to call stored procedures>> section for more info.
[[annotations-jpa-table]] [[annotations-jpa-table]]
==== `@Table` ==== `@Table`
The http://docs.oracle.com/javaee/7/api/javax/persistence/Table.html[`@Table`] annotation is used to specify the primary table of the currently annotated entity. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Table.html[`@Table`] annotation is used to specify the primary table of the currently annotated entity.
See the <<chapters/query/native/Native.adoc#sql-custom-crud-secondary-table-example, `@Table` mapping>> section for more info. See the <<chapters/query/native/Native.adoc#sql-custom-crud-secondary-table-example, `@Table` mapping>> section for more info.
[[annotations-jpa-tablegenerator]] [[annotations-jpa-tablegenerator]]
==== `@TableGenerator` ==== `@TableGenerator`
The http://docs.oracle.com/javaee/7/api/javax/persistence/TableGenerator.html[`@TableGenerator`] annotation is used to specify the database table used by the identity generator of the currently annotated entity. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/TableGenerator.html[`@TableGenerator`] annotation is used to specify the database table used by the identity generator of the currently annotated entity.
See the <<chapters/domain/identifiers.adoc#identifiers-generators-table-configured-mapping-example,`@TableGenerator` mapping>> section for more info. See the <<chapters/domain/identifiers.adoc#identifiers-generators-table-configured-mapping-example,`@TableGenerator` mapping>> section for more info.
[[annotations-jpa-temporal]] [[annotations-jpa-temporal]]
==== `@Temporal` ==== `@Temporal`
The http://docs.oracle.com/javaee/7/api/javax/persistence/Temporal.html[`@Temporal`] annotation is used to specify the `TemporalType` of the currently annotated `java.util.Date` or `java.util.Calendar` entity attribute. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Temporal.html[`@Temporal`] annotation is used to specify the `TemporalType` of the currently annotated `java.util.Date` or `java.util.Calendar` entity attribute.
See the <<chapters/domain/basic_types.adoc#basic-datetime,Basic temporal types>> chapter for more info. See the <<chapters/domain/basic_types.adoc#basic-datetime,Basic temporal types>> chapter for more info.
[[annotations-jpa-transient]] [[annotations-jpa-transient]]
==== `@Transient` ==== `@Transient`
The http://docs.oracle.com/javaee/7/api/javax/persistence/Transient.html[`@Transient`] annotation is used to specify that a given entity attribute should not be persisted. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Transient.html[`@Transient`] annotation is used to specify that a given entity attribute should not be persisted.
See the <<chapters/events/Events.adoc#events-jpa-callbacks-example, `@Transient` mapping>> section for more info. See the <<chapters/events/Events.adoc#events-jpa-callbacks-example, `@Transient` mapping>> section for more info.
[[annotations-jpa-uniqueconstraint]] [[annotations-jpa-uniqueconstraint]]
==== `@UniqueConstraint` ==== `@UniqueConstraint`
The http://docs.oracle.com/javaee/7/api/javax/persistence/UniqueConstraint.html[`@UniqueConstraint`] annotation is used to specify a unique constraint to be included by the automated schema generator for the primary or secondary table associated with the currently annotated entity. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/UniqueConstraint.html[`@UniqueConstraint`] annotation is used to specify a unique constraint to be included by the automated schema generator for the primary or secondary table associated with the currently annotated entity.
See the <<chapters/schema/Schema.adoc#schema-generation-columns-unique-constraint, Columns unique constraint>> chapter for more info. See the <<chapters/schema/Schema.adoc#schema-generation-columns-unique-constraint, Columns unique constraint>> chapter for more info.
[[annotations-jpa-version]] [[annotations-jpa-version]]
==== `@Version` ==== `@Version`
The http://docs.oracle.com/javaee/7/api/javax/persistence/Version.html[`@Version`] annotation is used to specify the version attribute used for optimistic locking. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Version.html[`@Version`] annotation is used to specify the version attribute used for optimistic locking.
See the <<chapters/locking/Locking.adoc#locking-optimistic, Optimistic locking mapping>> section for more info. See the <<chapters/locking/Locking.adoc#locking-optimistic, Optimistic locking mapping>> section for more info.
@ -676,7 +676,7 @@ See the <<chapters/caching/Caching.adoc#caching,Caching>> chapter for more info.
The https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/annotations/Cascade.html[`@Cascade`] annotation is used to apply the Hibernate specific http://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/annotations/CascadeType.html[`CascadeType`] strategies (e.g. `CascadeType.LOCK`, `CascadeType.SAVE_UPDATE`, `CascadeType.REPLICATE`) on a given association. The https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/annotations/Cascade.html[`@Cascade`] annotation is used to apply the Hibernate specific http://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/annotations/CascadeType.html[`CascadeType`] strategies (e.g. `CascadeType.LOCK`, `CascadeType.SAVE_UPDATE`, `CascadeType.REPLICATE`) on a given association.
For JPA cascading, prefer using the http://docs.oracle.com/javaee/7/api/javax/persistence/CascadeType.html[`javax.persistence.CascadeType`] instead. For JPA cascading, prefer using the https://javaee.github.io/javaee-spec/javadocs/javax/persistence/CascadeType.html[`javax.persistence.CascadeType`] instead.
When combining both JPA and Hibernate `CascadeType` strategies, Hibernate will merge both sets of cascades. When combining both JPA and Hibernate `CascadeType` strategies, Hibernate will merge both sets of cascades.
@ -930,7 +930,7 @@ The possible values are given by the `https://docs.jboss.org/hibernate/orm/{majo
`FALSE`:: Eagerly load it. `FALSE`:: Eagerly load it.
`EXTRA`:: Prefer extra queries over full collection loading. `EXTRA`:: Prefer extra queries over full collection loading.
The `TRUE` and `FALSE` values are deprecated since you should be using the JPA http://docs.oracle.com/javaee/7/api/javax/persistence/FetchType.html[`FetchType`] attribute of the <<annotations-jpa-elementcollection>>, <<annotations-jpa-onetomany>>, or <<annotations-jpa-manytomany>> collection. The `TRUE` and `FALSE` values are deprecated since you should be using the JPA https://javaee.github.io/javaee-spec/javadocs/javax/persistence/FetchType.html[`FetchType`] attribute of the <<annotations-jpa-elementcollection>>, <<annotations-jpa-onetomany>>, or <<annotations-jpa-manytomany>> collection.
The `EXTRA` value has no equivalent in the JPA specification, and it's used to avoid loading the entire collection even when the collection is accessed for the first time. The `EXTRA` value has no equivalent in the JPA specification, and it's used to avoid loading the entire collection even when the collection is accessed for the first time.
Each element is fetched individually using a secondary query. Each element is fetched individually using a secondary query.

View File

@ -248,11 +248,11 @@ include::{sourcedir}/BootstrapTest.java[tags=bootstrap-jpa-compliant-EntityManag
[NOTE] [NOTE]
==== ====
If you don't want to provide a `persistence.xml` configuration file, JPA allows you to provide all the configuration options in a If you don't want to provide a `persistence.xml` configuration file, JPA allows you to provide all the configuration options in a
http://docs.oracle.com/javaee/7/api/javax/persistence/spi/PersistenceUnitInfo.html[`PersistenceUnitInfo`] implementation and call https://javaee.github.io/javaee-spec/javadocs/javax/persistence/spi/PersistenceUnitInfo.html[`PersistenceUnitInfo`] implementation and call
https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/jpa/HibernatePersistenceProvider.html#createContainerEntityManagerFactory-javax.persistence.spi.PersistenceUnitInfo-java.util.Map-[`HibernatePersistenceProvider.html#createContainerEntityManagerFactory`]. https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/jpa/HibernatePersistenceProvider.html#createContainerEntityManagerFactory-javax.persistence.spi.PersistenceUnitInfo-java.util.Map-[`HibernatePersistenceProvider.html#createContainerEntityManagerFactory`].
==== ====
To inject the default Persistence Context, you can use the http://docs.oracle.com/javaee/7/api/javax/persistence/PersistenceContext.html[`@PersistenceContext`] annotation. To inject the default Persistence Context, you can use the https://javaee.github.io/javaee-spec/javadocs/javax/persistence/PersistenceContext.html[`@PersistenceContext`] annotation.
[[bootstrap-jpa-compliant-PersistenceContext-example]] [[bootstrap-jpa-compliant-PersistenceContext-example]]
.Inject the default `EntityManager` .Inject the default `EntityManager`
@ -264,9 +264,9 @@ include::{sourcedir}/BootstrapTest.java[tags=bootstrap-jpa-compliant-Persistence
==== ====
To inject a specific Persistence Context, To inject a specific Persistence Context,
you can use the http://docs.oracle.com/javaee/7/api/javax/persistence/PersistenceContext.html[`@PersistenceContext`] annotation, you can use the https://javaee.github.io/javaee-spec/javadocs/javax/persistence/PersistenceContext.html[`@PersistenceContext`] annotation,
and you can even pass `EntityManager`-specific properties using the and you can even pass `EntityManager`-specific properties using the
http://docs.oracle.com/javaee/7/api/javax/persistence/PersistenceProperty.html[`@PersistenceProperty`] annotation. https://javaee.github.io/javaee-spec/javadocs/javax/persistence/PersistenceProperty.html[`@PersistenceProperty`] annotation.
[[bootstrap-jpa-compliant-PersistenceContext-configurable-example]] [[bootstrap-jpa-compliant-PersistenceContext-configurable-example]]

View File

@ -376,7 +376,7 @@ include::{sourcedir}/SecondLevelCacheTest.java[tags=caching-query-region-store-m
[NOTE] [NOTE]
==== ====
When using http://docs.oracle.com/javaee/7/api/javax/persistence/CacheStoreMode.html#REFRESH[`CacheStoreMode.REFRESH`] or https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/CacheMode.html#REFRESH[`CacheMode.REFRESH`] in conjunction with the region you have defined for the given query, When using https://javaee.github.io/javaee-spec/javadocs/javax/persistence/CacheStoreMode.html#REFRESH[`CacheStoreMode.REFRESH`] or https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/CacheMode.html#REFRESH[`CacheMode.REFRESH`] in conjunction with the region you have defined for the given query,
Hibernate will selectively force the results cached in that particular region to be refreshed. Hibernate will selectively force the results cached in that particular region to be refreshed.
This is particularly useful in cases where underlying data may have been updated via a separate process This is particularly useful in cases where underlying data may have been updated via a separate process
@ -393,8 +393,8 @@ include::{sourcedir}/SecondLevelCacheTest.java[tags=caching-query-region-native-
Traditionally, Hibernate defined the https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/CacheMode.html[`CacheMode`] enumeration to describe Traditionally, Hibernate defined the https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/CacheMode.html[`CacheMode`] enumeration to describe
the ways of interactions with the cached data. the ways of interactions with the cached data.
JPA split cache modes by storage (http://docs.oracle.com/javaee/7/api/javax/persistence/CacheStoreMode.html[`CacheStoreMode`]) JPA split cache modes by storage (https://javaee.github.io/javaee-spec/javadocs/javax/persistence/CacheStoreMode.html[`CacheStoreMode`])
and retrieval (http://docs.oracle.com/javaee/7/api/javax/persistence/CacheRetrieveMode.html[`CacheRetrieveMode`]). and retrieval (https://javaee.github.io/javaee-spec/javadocs/javax/persistence/CacheRetrieveMode.html[`CacheRetrieveMode`]).
The relationship between Hibernate and JPA cache modes can be seen in the following table: The relationship between Hibernate and JPA cache modes can be seen in the following table:

View File

@ -414,7 +414,7 @@ include::{extrasdir}/collections-customizing-ordered-list-ordinal-persist-exampl
===== Customizing ORDER BY SQL clause ===== Customizing ORDER BY SQL clause
While the JPA While the JPA
http://docs.oracle.com/javaee/7/api/javax/persistence/OrderBy.html[`@OrderBy`] annotation allows you to specify the entity attributes used for sorting https://javaee.github.io/javaee-spec/javadocs/javax/persistence/OrderBy.html[`@OrderBy`] annotation allows you to specify the entity attributes used for sorting
when fetching the current annotated collection, the Hibernate specific when fetching the current annotated collection, the Hibernate specific
https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/annotations/OrderBy.html[`@OrderBy`] annotation is used to specify a *SQL* clause instead. https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/annotations/OrderBy.html[`@OrderBy`] annotation is used to specify a *SQL* clause instead.
@ -644,7 +644,7 @@ include::{sourcedir}/MapKeyClassTest.java[tags=collections-map-key-class-type-ma
==== ====
If you want to use the `PhoneNumber` interface as a `java.util.Map` key, then you need to supply the If you want to use the `PhoneNumber` interface as a `java.util.Map` key, then you need to supply the
http://docs.oracle.com/javaee/7/api/javax/persistence/MapKeyClass.html[`@MapKeyClass`] annotation as well. https://javaee.github.io/javaee-spec/javadocs/javax/persistence/MapKeyClass.html[`@MapKeyClass`] annotation as well.
[[collections-map-key-class-mapping-example]] [[collections-map-key-class-mapping-example]]
.`@MapKeyClass` mapping example .`@MapKeyClass` mapping example

View File

@ -95,8 +95,8 @@ JPA defines the `@AttributeOverride` annotation to handle this scenario.
This way, the mapping conflict is resolved by setting up explicit name-based property-column type mappings. This way, the mapping conflict is resolved by setting up explicit name-based property-column type mappings.
If an Embeddable type is used multiple times in some entity, you need to use the If an Embeddable type is used multiple times in some entity, you need to use the
http://docs.oracle.com/javaee/7/api/javax/persistence/AttributeOverride.html[`@AttributeOverride`] and https://javaee.github.io/javaee-spec/javadocs/javax/persistence/AttributeOverride.html[`@AttributeOverride`] and
http://docs.oracle.com/javaee/7/api/javax/persistence/AssociationOverride.html[`@AssociationOverride`] annotations https://javaee.github.io/javaee-spec/javadocs/javax/persistence/AssociationOverride.html[`@AssociationOverride`] annotations
to override the default column names defined by the Embeddable. to override the default column names defined by the Embeddable.
Considering you have the following `Publisher` embeddable type Considering you have the following `Publisher` embeddable type
@ -204,13 +204,13 @@ Embeddable types that are used as collection entries, map keys or entity type id
The https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/annotations/Target.html[`@Target`] annotation is used to specify the implementation class of a given association that is mapped via an interface. The https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/annotations/Target.html[`@Target`] annotation is used to specify the implementation class of a given association that is mapped via an interface.
The The
http://docs.oracle.com/javaee/7/api/javax/persistence/ManyToOne.html[`@ManyToOne`], https://javaee.github.io/javaee-spec/javadocs/javax/persistence/ManyToOne.html[`@ManyToOne`],
http://docs.oracle.com/javaee/7/api/javax/persistence/OneToOne.html[`@OneToOne`], https://javaee.github.io/javaee-spec/javadocs/javax/persistence/OneToOne.html[`@OneToOne`],
http://docs.oracle.com/javaee/7/api/javax/persistence/OneToMany.html[`@OneToMany`], and https://javaee.github.io/javaee-spec/javadocs/javax/persistence/OneToMany.html[`@OneToMany`], and
http://docs.oracle.com/javaee/7/api/javax/persistence/ManyToMany.html[`@ManyToMany`] https://javaee.github.io/javaee-spec/javadocs/javax/persistence/ManyToMany.html[`@ManyToMany`]
feature a http://docs.oracle.com/javaee/7/api/javax/persistence/ManyToOne.html#targetEntity--[`targetEntity`] attribute to specify the actual class of the entity association when an interface is used for the mapping. feature a https://javaee.github.io/javaee-spec/javadocs/javax/persistence/ManyToOne.html#targetEntity--[`targetEntity`] attribute to specify the actual class of the entity association when an interface is used for the mapping.
The http://docs.oracle.com/javaee/7/api/javax/persistence/ElementCollection.html[`@ElementCollection`] association has a http://docs.oracle.com/javaee/7/api/javax/persistence/ElementCollection.html#targetClass--[`targetClass`] attribute for the same purpose. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/ElementCollection.html[`@ElementCollection`] association has a https://javaee.github.io/javaee-spec/javadocs/javax/persistence/ElementCollection.html#targetClass--[`targetClass`] attribute for the same purpose.
However, for simple embeddable types, there is no such construct and so you need to use the Hibernate-specific `@Target` annotation instead. However, for simple embeddable types, there is no such construct and so you need to use the Hibernate-specific `@Target` annotation instead.

View File

@ -113,9 +113,9 @@ Hibernate offers multiple identifier generation strategies, see the <<chapters/d
[[entity-pojo-mapping]] [[entity-pojo-mapping]]
==== Mapping the entity ==== Mapping the entity
The main piece in mapping the entity is the http://docs.oracle.com/javaee/7/api/javax/persistence/Entity.html[`javax.persistence.Entity`] annotation. The main piece in mapping the entity is the https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Entity.html[`javax.persistence.Entity`] annotation.
The `@Entity` annotation defines just the https://docs.oracle.com/javaee/7/api/javax/persistence/Entity.html#name--[`name`] attribute which is used to give a specific entity name for use in JPQL queries. The `@Entity` annotation defines just the https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Entity.html#name--[`name`] attribute which is used to give a specific entity name for use in JPQL queries.
By default, if the name attribute the `@Entity` annotation is missing, the unqualified name of the entity class itself will be used as the entity name By default, if the name attribute the `@Entity` annotation is missing, the unqualified name of the entity class itself will be used as the entity name

View File

@ -351,7 +351,7 @@ If no table name is given Hibernate assumes an implicit name of `hibernate_seque
Additionally, because no `javax.persistence.TableGenerator#pkColumnValue` is specified, Additionally, because no `javax.persistence.TableGenerator#pkColumnValue` is specified,
Hibernate will use the default segment (`sequence_name='default'`) from the hibernate_sequences table. Hibernate will use the default segment (`sequence_name='default'`) from the hibernate_sequences table.
However, you can configure the table identifier generator using the http://docs.oracle.com/javaee/7/api/javax/persistence/TableGenerator.html[`@TableGenerator`] annotation. However, you can configure the table identifier generator using the https://javaee.github.io/javaee-spec/javadocs/javax/persistence/TableGenerator.html[`@TableGenerator`] annotation.
[[identifiers-generators-table-configured-mapping-example]] [[identifiers-generators-table-configured-mapping-example]]
.Configured table generator .Configured table generator

View File

@ -247,8 +247,8 @@ include::{extrasdir}/events-default-listener-update-example.sql[]
If you already registered a default entity listener, but you don't want to apply it to a particular entity, If you already registered a default entity listener, but you don't want to apply it to a particular entity,
you can use the you can use the
http://docs.oracle.com/javaee/7/api/javax/persistence/ExcludeDefaultListeners.html[`@ExcludeDefaultListeners`] and https://javaee.github.io/javaee-spec/javadocs/javax/persistence/ExcludeDefaultListeners.html[`@ExcludeDefaultListeners`] and
http://docs.oracle.com/javaee/7/api/javax/persistence/ExcludeSuperclassListeners.html[`@ExcludeSuperclassListeners`] JPA annotations. https://javaee.github.io/javaee-spec/javadocs/javax/persistence/ExcludeSuperclassListeners.html[`@ExcludeSuperclassListeners`] JPA annotations.
`@ExcludeDefaultListeners` instructs the current class to ignore the default entity listeners for the current entity `@ExcludeDefaultListeners` instructs the current class to ignore the default entity listeners for the current entity
while `@ExcludeSuperclassListeners` is used to ignore the default entity listeners propagated to the `BaseEntity` super-class. while `@ExcludeSuperclassListeners` is used to ignore the default entity listeners propagated to the `BaseEntity` super-class.

View File

@ -221,7 +221,7 @@ An EntityGraph is the root of a "load plan" and must correspond to an EntityType
==== JPA (key) subgraphs ==== JPA (key) subgraphs
A sub-graph is used to control the fetching of sub-attributes of the AttributeNode it is applied to. A sub-graph is used to control the fetching of sub-attributes of the AttributeNode it is applied to.
It is generally defined via the http://docs.oracle.com/javaee/7/api/javax/persistence/NamedSubgraph.html[`@NamedSubgraph`] annotation. It is generally defined via the https://javaee.github.io/javaee-spec/javadocs/javax/persistence/NamedSubgraph.html[`@NamedSubgraph`] annotation.
If we have a `Project` parent entity which has an `employees` child associations, If we have a `Project` parent entity which has an `employees` child associations,
and we'd like to fetch the `department` for the `Employee` child association. and we'd like to fetch the `department` for the `Employee` child association.
@ -589,7 +589,7 @@ The possible values are given by the `https://docs.jboss.org/hibernate/orm/{majo
`FALSE`:: Eagerly load it. `FALSE`:: Eagerly load it.
`EXTRA`:: Prefer extra queries over full collection loading. `EXTRA`:: Prefer extra queries over full collection loading.
The `TRUE` and `FALSE` values are deprecated since you should be using the JPA http://docs.oracle.com/javaee/7/api/javax/persistence/FetchType.html[`FetchType`] attribute of the <<annotations-jpa-elementcollection>>, <<annotations-jpa-onetomany>>, or <<annotations-jpa-manytomany>> collection. The `TRUE` and `FALSE` values are deprecated since you should be using the JPA https://javaee.github.io/javaee-spec/javadocs/javax/persistence/FetchType.html[`FetchType`] attribute of the <<annotations-jpa-elementcollection>>, <<annotations-jpa-onetomany>>, or <<annotations-jpa-manytomany>> collection.
The `EXTRA` value has no equivalent in the JPA specification, and it's used to avoid loading the entire collection even when the collection is accessed for the first time. The `EXTRA` value has no equivalent in the JPA specification, and it's used to avoid loading the entire collection even when the collection is accessed for the first time.
Each element is fetched individually using a secondary query. Each element is fetched individually using a secondary query.

View File

@ -312,7 +312,7 @@ Hibernate always uses the locking mechanism of the database, and never lock obje
=== `LockMode` and `LockModeType` === `LockMode` and `LockModeType`
Long before JPA 1.0, Hibernate already defined various explicit locking strategies through its `LockMode` enumeration. Long before JPA 1.0, Hibernate already defined various explicit locking strategies through its `LockMode` enumeration.
JPA comes with its own http://docs.oracle.com/javaee/7/api/javax/persistence/LockModeType.html[`LockModeType`] enumeration which defines similar strategies as the Hibernate-native `LockMode`. JPA comes with its own https://javaee.github.io/javaee-spec/javadocs/javax/persistence/LockModeType.html[`LockModeType`] enumeration which defines similar strategies as the Hibernate-native `LockMode`.
[cols=",,",, options="header"] [cols=",,",, options="header"]
|======================================================================= |=======================================================================
@ -351,7 +351,7 @@ This ensures that applications are portable.
JPA 2.0 introduced two query hints: JPA 2.0 introduced two query hints:
javax.persistence.lock.timeout:: it gives the number of milliseconds a lock acquisition request will wait before throwing an exception javax.persistence.lock.timeout:: it gives the number of milliseconds a lock acquisition request will wait before throwing an exception
javax.persistence.lock.scope:: defines the http://docs.oracle.com/javaee/7/api/javax/persistence/PessimisticLockScope.html[_scope_] of the lock acquisition request. javax.persistence.lock.scope:: defines the https://javaee.github.io/javaee-spec/javadocs/javax/persistence/PessimisticLockScope.html[_scope_] of the lock acquisition request.
The scope can either be `NORMAL` (default value) or `EXTENDED`. The `EXTENDED` scope will cause a lock acquisition request to be passed to other owned table structured (e.g. `@Inheritance(strategy=InheritanceType.JOINED)`, `@ElementCollection`) The scope can either be `NORMAL` (default value) or `EXTENDED`. The `EXTENDED` scope will cause a lock acquisition request to be passed to other owned table structured (e.g. `@Inheritance(strategy=InheritanceType.JOINED)`, `@ElementCollection`)
[[locking-jpa-query-hints-timeout-example]] [[locking-jpa-query-hints-timeout-example]]

View File

@ -1283,7 +1283,7 @@ Certain methods of the JPA `EntityManager` or the Hibernate `Session` will not l
Rolling back the database transaction does not put your business objects back into the state they were at the start of the transaction. This means that the database state and the business objects will be out of sync. Usually, this is not a problem because exceptions are not recoverable and you will have to start over after rollback anyway. Rolling back the database transaction does not put your business objects back into the state they were at the start of the transaction. This means that the database state and the business objects will be out of sync. Usually, this is not a problem because exceptions are not recoverable and you will have to start over after rollback anyway.
The JPA https://docs.oracle.com/javaee/7/api/javax/persistence/PersistenceException.html[`PersistenceException`] or the The JPA https://javaee.github.io/javaee-spec/javadocs/javax/persistence/PersistenceException.html[`PersistenceException`] or the
https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/HibernateException.html[`HibernateException`] wraps most of the errors that can occur in a Hibernate persistence layer. https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/HibernateException.html[`HibernateException`] wraps most of the errors that can occur in a Hibernate persistence layer.
Both the `PersistenceException` and the `HibernateException` are runtime exceptions because, in our opinion, we should not force the application developer to catch an unrecoverable exception at a low layer. In most systems, unchecked and fatal exceptions are handled in one of the first frames of the method call stack (i.e., in higher layers) and either an error message is presented to the application user or some other appropriate action is taken. Note that Hibernate might also throw other unchecked exceptions that are not a `HibernateException`. These are not recoverable either, and appropriate action should be taken. Both the `PersistenceException` and the `HibernateException` are runtime exceptions because, in our opinion, we should not force the application developer to catch an unrecoverable exception at a low layer. In most systems, unchecked and fatal exceptions are handled in one of the first frames of the method call stack (i.e., in higher layers) and either an error message is presented to the application user or some other appropriate action is taken. Note that Hibernate might also throw other unchecked exceptions that are not a `HibernateException`. These are not recoverable either, and appropriate action should be taken.
@ -1326,7 +1326,7 @@ SQLGrammarException::
[NOTE] [NOTE]
==== ====
Starting with Hibernate 5.2, the Hibernate `Session` extends the JPA `EntityManager`. For this reason, when a `SessionFactory` is built via Hibernate's native bootstrapping, Starting with Hibernate 5.2, the Hibernate `Session` extends the JPA `EntityManager`. For this reason, when a `SessionFactory` is built via Hibernate's native bootstrapping,
the `HibernateException` or `SQLException` can be wrapped in a JPA https://docs.oracle.com/javaee/7/api/javax/persistence/PersistenceException.html[`PersistenceException`] when thrown the `HibernateException` or `SQLException` can be wrapped in a JPA https://javaee.github.io/javaee-spec/javadocs/javax/persistence/PersistenceException.html[`PersistenceException`] when thrown
by `Session` methods that implement `EntityManager` methods (e.g., https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/Session.html#merge-java.lang.Object-[Session.merge(Object object)], by `Session` methods that implement `EntityManager` methods (e.g., https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/Session.html#merge-java.lang.Object-[Session.merge(Object object)],
https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/Session.html#flush--[Session.flush()]). https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/Session.html#flush--[Session.flush()]).

View File

@ -98,7 +98,7 @@ include::{sourcedir}/HQLTest.java[tags=jpql-api-basic-usage-example]
---- ----
==== ====
For complete details, see the `Query` http://docs.oracle.com/javaee/7/api/javax/persistence/Query.html[Javadocs]. For complete details, see the `Query` https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Query.html[Javadocs].
Many of the settings controlling the execution of the query are defined as hints. Many of the settings controlling the execution of the query are defined as hints.
JPA defines some standard hints (like timeout in the example), but most are provider specific. JPA defines some standard hints (like timeout in the example), but most are provider specific.
Relying on provider specific hints limits your applications portability to some degree. Relying on provider specific hints limits your applications portability to some degree.
@ -1929,7 +1929,7 @@ include::{extrasdir}/hql-read-only-entities-example.sql[]
As you can see, there is no SQL `UPDATE` being executed. As you can see, there is no SQL `UPDATE` being executed.
You can also pass the read-only hint to named queries using the JPA http://docs.oracle.com/javaee/7/api/javax/persistence/QueryHint.html[`@QueryHint`] annotation. You can also pass the read-only hint to named queries using the JPA https://javaee.github.io/javaee-spec/javadocs/javax/persistence/QueryHint.html[`@QueryHint`] annotation.
[[jpa-read-only-entities-native-example]] [[jpa-read-only-entities-native-example]]
.Fetching read-only entities using a named query and the read-only hint .Fetching read-only entities using a named query and the read-only hint

View File

@ -840,7 +840,7 @@ For SQL Server, if you can enable `SET NOCOUNT ON` in your procedure it will pro
=== Using named queries to call stored procedures === Using named queries to call stored procedures
Just like with SQL statements, you can also use named queries to call stored procedures. Just like with SQL statements, you can also use named queries to call stored procedures.
For this purpose, JPA defines the http://docs.oracle.com/javaee/7/api/javax/persistence/NamedStoredProcedureQuery.html[`@NamedStoredProcedureQuery`] annotation. For this purpose, JPA defines the https://javaee.github.io/javaee-spec/javadocs/javax/persistence/NamedStoredProcedureQuery.html[`@NamedStoredProcedureQuery`] annotation.
[[sql-sp-ref-cursor-oracle-named-query-example]] [[sql-sp-ref-cursor-oracle-named-query-example]]
.Oracle `REF_CURSOR` named query stored procedure .Oracle `REF_CURSOR` named query stored procedure

View File

@ -163,7 +163,7 @@ include::{extrasdir}/schema-generation-column-default-value-persist-example.sql[
[[schema-generation-columns-unique-constraint]] [[schema-generation-columns-unique-constraint]]
=== Columns unique constraint === Columns unique constraint
The http://docs.oracle.com/javaee/7/api/javax/persistence/UniqueConstraint.html[`@UniqueConstraint`] annotation is used to specify a unique constraint to be included by the automated schema generator for the primary or secondary table associated with the current annotated entity. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/UniqueConstraint.html[`@UniqueConstraint`] annotation is used to specify a unique constraint to be included by the automated schema generator for the primary or secondary table associated with the current annotated entity.
Considering the following entity mapping, Hibernate generates the unique constraint DDL when creating the database schema: Considering the following entity mapping, Hibernate generates the unique constraint DDL when creating the database schema:
@ -203,7 +203,7 @@ The second INSERT statement fails because of the unique constraint violation.
[[schema-generation-columns-index]] [[schema-generation-columns-index]]
=== Columns index === Columns index
The http://docs.oracle.com/javaee/7/api/javax/persistence/Index.html[`@Index`] annotation is used by the automated schema generation tool to create a database index. The https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Index.html[`@Index`] annotation is used by the automated schema generation tool to create a database index.
Considering the following entity mapping, Hibernate generates the index when creating the database schema: Considering the following entity mapping, Hibernate generates the index when creating the database schema: