diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/Check.java b/hibernate-core/src/main/java/org/hibernate/annotations/Check.java index 38c2a1fa1350..60f4c5b7f2d7 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/Check.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/Check.java @@ -42,10 +42,15 @@ * @author Gavin King * * @see DialectOverride.Check + * + * @deprecated Prefer {@link jakarta.persistence.Table#check}, + * {@link jakarta.persistence.Column#check}, etc., + * with {@link jakarta.persistence.CheckConstraint @CheckConstraint}. */ @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) @Repeatable(Checks.class) +@Deprecated(since = "7") public @interface Check { /** * The optional name of the check constraint. diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/Comment.java b/hibernate-core/src/main/java/org/hibernate/annotations/Comment.java index aa97d790dfaf..aad722895d18 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/Comment.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/Comment.java @@ -11,8 +11,6 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; -import jakarta.persistence.Table; - import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; @@ -49,7 +47,8 @@ * @author Yanming Zhou * @author Gavin King * - * @deprecated Prefer {@linkplain Table#comment()} + * @deprecated Prefer {@link jakarta.persistence.Table#comment}, + * {@link jakarta.persistence.Column#comment}, etc. */ @TypeBinderType(binder = CommentBinder.class) @AttributeBinderType(binder = CommentBinder.class) diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/Parameter.java b/hibernate-core/src/main/java/org/hibernate/annotations/Parameter.java index 0edc0a353f4d..4c83e44d628e 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/Parameter.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/Parameter.java @@ -3,15 +3,22 @@ * Copyright Red Hat Inc. and Hibernate Authors */ package org.hibernate.annotations; + import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.RetentionPolicy.RUNTIME; /** - * Generic parameter (basically a key/value combination) used to parametrize other annotations. + * Generic parameter (a key/value pair) used to parametrize other annotations. * * @author Emmanuel Bernard + * + * @see Type#parameters + * @see CollectionType#parameters + * @see CollectionIdType#parameters + * @see MapKeyType#parameters + * @see GenericGenerator#parameters */ @Target({}) @Retention(RUNTIME) diff --git a/hibernate-core/src/main/java/org/hibernate/usertype/ParameterizedType.java b/hibernate-core/src/main/java/org/hibernate/usertype/ParameterizedType.java index bf8a3e03c894..bf38b6843984 100644 --- a/hibernate-core/src/main/java/org/hibernate/usertype/ParameterizedType.java +++ b/hibernate-core/src/main/java/org/hibernate/usertype/ParameterizedType.java @@ -12,6 +12,8 @@ * may be set by using a nested type element for the property element in the mapping * file, or by defining a typedef. * + * @see org.hibernate.annotations.Type#parameters + * * @author Michael Gloegl */ public interface ParameterizedType { diff --git a/migration-guide.adoc b/migration-guide.adoc index 7c94b2be7b98..4d36c7adbeb7 100644 --- a/migration-guide.adoc +++ b/migration-guide.adoc @@ -439,12 +439,32 @@ In Hibernate 7, these SQL `UPDATE` statements only occur if the `@OrderColumn` i Since Vibur and Proxool are no longer actively developed, support for these connection pools was removed. Use Agroal or HikariCP instead. +== Converters incompatible with annotations + +JPA ``AttributeConverter``s are incompatible with the annotations `@Id`, `@Version`, `@Enumerated`, `@Embedded`, `@Temporal` and all association-mapping annotations. +Previously, any converter applied to an attribute with an incompatible annotation was simply ignored. +Hibernate now reports an error in this situation. + +This includes auto-applied converters. +To suppress the error for an auto-applied converter, use `@Convert(disableConversion=true)`. + +== Deprecations + +* `@Comment` is deprecated in favor of the JPA 3.2 `comment` members +* `@Comment` is deprecated in favor of the JPA 3.2 `@CheckConstraint` and `check` members +* `NullPrecedence` is deprecated in favor of JPA 3.2 `Nulls` +* `@FractionalSeconds` is deprecated in favor of JPA 3.2 `secondPrecision` +* `DynamicParameterizedType` is deprecated +* `Session.get()` is deprecated in favor of `find()` +* `@Cascade` and `org.hibernate.annotations.CascadeType` are deprecated in favor of JPA `cascade` and `CascadeType` +* `org.hibernate.annotations.FlushModeType` is deprecated in favor of `QueryFlushMode` + [[cleanup]] == Cleanup * Annotations ** Removed `@Persister` -** Removed `@Proxy` - see <> +** Removed `@Proxy` -- see <> ** Removed `@SelectBeforeUpdate` ** Removed `@DynamicInsert#value` and `@DynamicUpdate#value` ** Removed `@Loader`