diff --git a/documentation/src/main/asciidoc/userguide/chapters/events/Events.adoc b/documentation/src/main/asciidoc/userguide/chapters/events/Events.adoc index 429470e0c6..d0cb829a1c 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/events/Events.adoc +++ b/documentation/src/main/asciidoc/userguide/chapters/events/Events.adoc @@ -26,11 +26,6 @@ include::{example-dir-event}/InterceptorTest.java[tags=events-interceptors-examp ---- ==== -[NOTE] -==== -You can either implement `Interceptor` directly or extend the `org.hibernate.EmptyInterceptor` base class. -==== - An Interceptor can be either `Session`-scoped or `SessionFactory`-scoped. A Session-scoped interceptor is specified when a session is opened. diff --git a/hibernate-core/src/main/java/org/hibernate/EmptyInterceptor.java b/hibernate-core/src/main/java/org/hibernate/EmptyInterceptor.java deleted file mode 100644 index 170437123b..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/EmptyInterceptor.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate; - -import java.io.Serializable; - -import org.hibernate.metamodel.RepresentationMode; -import org.hibernate.type.Type; - -/** - * An interceptor that does nothing. May be used as a base class for application-defined custom interceptors. - * - * @author Gavin King - * - * @deprecated implement {@link Interceptor} directly - */ -@Deprecated(since = "6.0") -public class EmptyInterceptor implements Interceptor, Serializable { - - protected EmptyInterceptor() {} - -} diff --git a/hibernate-core/src/main/java/org/hibernate/internal/EmptyInterceptor.java b/hibernate-core/src/main/java/org/hibernate/internal/EmptyInterceptor.java index b1cfebd17a..7a21ecfaca 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/EmptyInterceptor.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/EmptyInterceptor.java @@ -14,9 +14,7 @@ import org.hibernate.type.Type; /** * An interceptor that does nothing. * This is an internal class and should not be used as a base to implement a custom Interceptor; - * it is similar to the public, deprecated {@link org.hibernate.EmptyInterceptor} but overrides - * the default methods for sake of efficiency: this wasn't possible on the original deprecated - * copy as that wouldn't have been backwards compatible. For this reason this copy is internal. + * it overrides the default methods for sake of efficiency. * * Implementors of Interceptor don't need a base class anymore since we now have default * implementations of the contract defined in the interface. diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/interceptor/CollectionInterceptor.java b/hibernate-core/src/test/java/org/hibernate/orm/test/interceptor/CollectionInterceptor.java index 72129dec7d..eb69177e8a 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/interceptor/CollectionInterceptor.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/interceptor/CollectionInterceptor.java @@ -18,7 +18,7 @@ public class CollectionInterceptor implements Interceptor { return false; } - public boolean onSave(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types) { + public boolean onPersist(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types) { ( (User) entity ).getActions().add("created"); return false; } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/interceptor/InterceptorTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/interceptor/InterceptorTest.java index 7266c7da22..54df81046a 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/interceptor/InterceptorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/interceptor/InterceptorTest.java @@ -180,7 +180,7 @@ public class InterceptorTest extends BaseCoreFunctionalTestCase { Session s = openSession( new Interceptor() { @Override - public boolean onSave( + public boolean onPersist( Object entity, Object id, Object[] state, diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/interceptor/PropertyInterceptor.java b/hibernate-core/src/test/java/org/hibernate/orm/test/interceptor/PropertyInterceptor.java index bf3eddc509..73994b7e60 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/interceptor/PropertyInterceptor.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/interceptor/PropertyInterceptor.java @@ -22,7 +22,7 @@ public class PropertyInterceptor implements Interceptor { } @Override - public boolean onSave(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types) { + public boolean onPersist(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types) { state[2] = Calendar.getInstance(); return true; } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/interceptor/StatefulInterceptor.java b/hibernate-core/src/test/java/org/hibernate/orm/test/interceptor/StatefulInterceptor.java index 126cbc6fe3..5456dbf5d2 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/interceptor/StatefulInterceptor.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/interceptor/StatefulInterceptor.java @@ -23,7 +23,7 @@ public class StatefulInterceptor implements Interceptor { private List list = new ArrayList(); @Override - public boolean onSave(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types) { + public boolean onPersist(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types) { if ( !(entity instanceof Log) ) { list.add( new Log( "insert", (String) id, entity.getClass().getName() ) ); } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/interfaceproxy/DocumentInterceptor.java b/hibernate-core/src/test/java/org/hibernate/orm/test/interfaceproxy/DocumentInterceptor.java index 5b634067c8..82f2de22c4 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/interfaceproxy/DocumentInterceptor.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/interfaceproxy/DocumentInterceptor.java @@ -35,7 +35,7 @@ public class DocumentInterceptor implements Interceptor { } } - public boolean onSave( + public boolean onPersist( Object entity, Object id, Object[] state, diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/ExceptionInterceptor.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/ExceptionInterceptor.java index becaa5c26c..cd77e5f39b 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/ExceptionInterceptor.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/ExceptionInterceptor.java @@ -34,7 +34,7 @@ public class ExceptionInterceptor implements Interceptor { } @Override - public boolean onSave(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types) + public boolean onPersist(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException { if (allowSave) return false; throw new IllegalStateException( EXCEPTION_MESSAGE ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/LocalExceptionInterceptor.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/LocalExceptionInterceptor.java index d6768aecd0..521b9d1a0e 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/LocalExceptionInterceptor.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/LocalExceptionInterceptor.java @@ -20,7 +20,7 @@ public class LocalExceptionInterceptor extends ExceptionInterceptor { public static final String LOCAL_EXCEPTION_MESSAGE = "Session-scoped interceptor enabled"; @Override - public boolean onSave(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types) + public boolean onPersist(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException { if (allowSave) return false; throw new IllegalStateException( LOCAL_EXCEPTION_MESSAGE ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mixed/DocumentInterceptor.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mixed/DocumentInterceptor.java index f27b541776..3a88c7016a 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mixed/DocumentInterceptor.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mixed/DocumentInterceptor.java @@ -35,7 +35,7 @@ public class DocumentInterceptor implements Interceptor { } } - public boolean onSave( + public boolean onPersist( Object entity, Object id, Object[] state,