From d7201815d5985837c42d6185f5b85f75fad7ade4 Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Wed, 4 Jan 2023 13:35:53 -0600 Subject: [PATCH] HHH-15977 - Deprecate @Persister --- .../main/asciidoc/userguide/chapters/domain/entity.adoc | 7 ++++++- .../src/main/java/org/hibernate/annotations/Persister.java | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/documentation/src/main/asciidoc/userguide/chapters/domain/entity.adoc b/documentation/src/main/asciidoc/userguide/chapters/domain/entity.adoc index 6c5eee080d..1481ae5227 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/domain/entity.adoc +++ b/documentation/src/main/asciidoc/userguide/chapters/domain/entity.adoc @@ -500,6 +500,11 @@ For entities, the custom persister must implement the https://docs.jboss.org/hib For collections, the custom persister must implement the https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/persister/collection/CollectionPersister.html[`CollectionPersister`] interface. +NOTE: Supplying a custom persister has been allowed historically, but has never been fully supported. +Hibernate 6 provides better, alternative ways to accomplish the use cases for a custom persister. As +of 6.2 `@Persister` has been formally deprecated. + + [[entity-persister-mapping]] .Entity persister mapping ==== @@ -515,4 +520,4 @@ include::{sourcedir-persister}/Book.java[tag=entity-persister-mapping,indent=0] ==== By providing your own `EntityPersister` and `CollectionPersister` implementations, -you can control how entities and collections are persisted into the database. \ No newline at end of file +you can control how entities and collections are persisted into the database. diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/Persister.java b/hibernate-core/src/main/java/org/hibernate/annotations/Persister.java index e79f5a7c34..5c3541dece 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/Persister.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/Persister.java @@ -18,9 +18,12 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; * Specify a custom persister. * * @author Shawn Clowater + * + * @deprecated Alternative depends on reason for custom persister */ @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) +@Deprecated( since = "6" ) public @interface Persister { /** * The custom persister class.