HHH-18452 Remove deprecated org.hibernate.Interceptor methods

This commit is contained in:
Andrea Boriero 2024-07-31 14:25:19 +02:00 committed by Steve Ebersole
parent e3fd3fad17
commit 37644a42a8
18 changed files with 78 additions and 403 deletions

View File

@ -6,7 +6,6 @@
*/
package org.hibernate;
import java.io.Serializable;
import java.util.Iterator;
import org.hibernate.metamodel.RepresentationMode;
@ -77,34 +76,6 @@ public interface Interceptor {
*/
default boolean onLoad(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types)
throws CallbackException {
if (id==null || id instanceof Serializable) {
return onLoad(entity, (Serializable) id, state, propertyNames, types);
}
return false;
}
/**
* Called just before an object is initialized. The interceptor may change the {@code state}, which will
* be propagated to the persistent object. Note that when this method is called, {@code entity} will be
* an empty uninitialized instance of the class.
*
* @apiNote The indexes across the {@code state}, {@code propertyNames}, and {@code types} arrays match.
*
* @param entity The entity instance being loaded
* @param id The identifier value being loaded
* @param state The entity state (which will be pushed into the entity instance)
* @param propertyNames The names of the entity properties, corresponding to the {@code state}.
* @param types The types of the entity properties, corresponding to the {@code state}.
*
* @return {@code true} if the user modified the {@code state} in any way.
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*
* @deprecated use {@link #onLoad(Object, Object, Object[], String[], Type[])}
*/
@Deprecated(since = "6.0")
default boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types)
throws CallbackException {
return false;
}
@ -182,67 +153,6 @@ public interface Interceptor {
Object[] previousState,
String[] propertyNames,
Type[] types) throws CallbackException {
if (id==null || id instanceof Serializable) {
return onFlushDirty(entity, (Serializable) id, currentState, previousState, propertyNames, types);
}
return false;
}
/**
* Called when an object is detected to be dirty, during a flush. The interceptor may modify the detected
* {@code currentState}, which will be propagated to both the database and the persistent object.
* Note that not all flushes end in actual synchronization with the database, in which case the
* new {@code currentState} will be propagated to the object, but not necessarily (immediately) to
* the database. It is strongly recommended that the interceptor <b>not</b> modify the {@code previousState}.
*
* @apiNote The indexes across the {@code currentState}, {@code previousState}, {@code propertyNames}, and
* {@code types} arrays match.
*
* @param entity The entity instance detected as being dirty and being flushed
* @param id The identifier of the entity
* @param currentState The entity's current state
* @param previousState The entity's previous (load time) state.
* @param propertyNames The names of the entity properties
* @param types The types of the entity properties
*
* @return {@code true} if the user modified the {@code currentState} in any way.
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*
* @deprecated use {@link #onFlushDirty(Object, Object, Object[], Object[], String[], Type[])}
*/
@Deprecated(since = "6.0")
default boolean onFlushDirty(
Object entity,
Serializable id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
Type[] types) throws CallbackException {
return false;
}
/**
* Called before an object is made persistent by a stateful session.
* <p>
* The interceptor may modify the {@code state}, which will be used for
* the SQL {@code INSERT} and propagated to the persistent object.
*
* @param entity The entity instance whose state is being inserted
* @param id The identifier of the entity
* @param state The state of the entity which will be inserted
* @param propertyNames The names of the entity properties.
* @param types The types of the entity properties
*
* @return {@code true} if the user modified the {@code state} in any way.
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*
* @deprecated use {@link #onSave(Object, Object, Object[], String[], Type[])}
*/
@Deprecated(since = "6.0")
default boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types)
throws CallbackException {
return false;
}
@ -270,31 +180,9 @@ public interface Interceptor {
@Deprecated(since = "6.6")
default boolean onSave(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types)
throws CallbackException {
if (id==null || id instanceof Serializable) {
return onSave(entity, (Serializable) id, state, propertyNames, types);
}
return false;
}
/**
* Called before an object is removed by a stateful session.
* <p>
* It is not recommended that the interceptor modify the {@code state}.
*
* @param entity The entity instance being deleted
* @param id The identifier of the entity
* @param state The state of the entity
* @param propertyNames The names of the entity properties.
* @param types The types of the entity properties
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*
* @deprecated use {@link #onDelete(Object, Object, Object[], String[], Type[])}
*/
@Deprecated(since = "6.0")
default void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types)
throws CallbackException {}
/**
* Called before an object is removed by a stateful session.
* <p>
@ -315,23 +203,7 @@ public interface Interceptor {
@Deprecated(since = "6.6")
default void onDelete(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types)
throws CallbackException {
if (id==null || id instanceof Serializable) {
onDelete(entity, (Serializable) id, state, propertyNames, types);
}
}
/**
* Called before a collection is (re)created.
*
* @param collection The collection instance.
* @param key The collection key value.
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*
* @deprecated use {@link #onCollectionRecreate(Object, Object)}
*/
@Deprecated(since = "6.0")
default void onCollectionRecreate(Object collection, Serializable key) throws CallbackException {}
/**
* Called before a collection is (re)created.
@ -342,23 +214,7 @@ public interface Interceptor {
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
default void onCollectionRecreate(Object collection, Object key) throws CallbackException {
if (key instanceof Serializable) {
onCollectionRecreate(collection, (Serializable) key);
}
}
/**
* Called before a collection is deleted.
*
* @param collection The collection instance.
* @param key The collection key value.
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*
* @deprecated use {@link #onCollectionRemove(Object, Object)}
*/
@Deprecated(since = "6.0")
default void onCollectionRemove(Object collection, Serializable key) throws CallbackException {}
/**
* Called before a collection is deleted.
@ -369,23 +225,7 @@ public interface Interceptor {
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
default void onCollectionRemove(Object collection, Object key) throws CallbackException {
if (key instanceof Serializable) {
onCollectionRemove(collection, (Serializable) key);
}
}
/**
* Called before a collection is updated.
*
* @param collection The collection instance.
* @param key The collection key value.
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*
* @deprecated use {@link #onCollectionUpdate(Object, Object)}
*/
@Deprecated(since = "6.0")
default void onCollectionUpdate(Object collection, Serializable key) throws CallbackException {}
/**
* Called before a collection is updated.
@ -396,9 +236,6 @@ public interface Interceptor {
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
default void onCollectionUpdate(Object collection, Object key) throws CallbackException {
if (key instanceof Serializable) {
onCollectionUpdate(collection, (Serializable) key);
}
}
/**
* Called before a flush.
@ -436,38 +273,6 @@ public interface Interceptor {
return null;
}
/**
* Called from {@code flush()}. The return value determines whether the entity is updated
* <ul>
* <li>an array of property indices - the entity is dirty
* <li>an empty array - the entity is not dirty
* <li>{@code null} - use Hibernate's default dirty-checking algorithm
* </ul>
*
* @param entity The entity for which to find dirty properties.
* @param id The identifier of the entity
* @param currentState The current entity state as taken from the entity instance
* @param previousState The state of the entity when it was last synchronized (generally when it was loaded)
* @param propertyNames The names of the entity properties.
* @param types The types of the entity properties
*
* @return array of dirty property indices or {@code null} to indicate Hibernate should perform default behaviour
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*
* @deprecated use {@link #findDirty(Object, Object, Object[], Object[], String[], Type[])}
*/
@Deprecated(since = "6.0")
default int[] findDirty(
Object entity,
Serializable id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
Type[] types) {
return null;
}
/**
* Called from {@code flush()}. The return value determines whether the entity is updated
* <ul>
@ -494,9 +299,6 @@ public interface Interceptor {
Object[] previousState,
String[] propertyNames,
Type[] types) {
if (id==null || id instanceof Serializable) {
return findDirty(entity, (Serializable) id, currentState, previousState, propertyNames, types);
}
return null;
}
@ -539,23 +341,6 @@ public interface Interceptor {
return null;
}
/**
* Get a fully loaded entity instance that is cached externally.
*
* @param entityName the name of the entity
* @param id the instance identifier
*
* @return a fully initialized entity
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*
* @deprecated use {@link #getEntity(String, Object)}
*/
@Deprecated(since = "6.0")
default Object getEntity(String entityName, Serializable id) throws CallbackException {
return null;
}
/**
* Get a fully loaded entity instance that is cached externally.
*
@ -567,9 +352,6 @@ public interface Interceptor {
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
default Object getEntity(String entityName, Object id) throws CallbackException {
if (id==null || id instanceof Serializable) {
return getEntity(entityName, (Serializable) id);
}
return null;
}

View File

@ -13,7 +13,7 @@ import jakarta.persistence.Cacheable;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import org.hibernate.EmptyInterceptor;
import org.hibernate.Interceptor;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.annotations.CacheConcurrencyStrategy;
@ -296,7 +296,7 @@ public class ReadWriteCacheTest extends BaseCoreFunctionalTestCase {
}
}
private final class TransactionInterceptor extends EmptyInterceptor {
private final class TransactionInterceptor implements Interceptor {
@Override
public void beforeTransactionCompletion(Transaction tx) {
if ( interceptTransaction.get() ) {

View File

@ -6,8 +6,6 @@
*/
package org.hibernate.orm.test.dirtiness;
import java.io.Serializable;
import org.hibernate.CustomEntityDirtinessStrategy;
import org.hibernate.Interceptor;
import org.hibernate.Session;
@ -203,7 +201,7 @@ public class CustomDirtinessStrategyTest extends BaseCoreFunctionalTestCase {
@Override
public boolean onFlushDirty(
Object entity,
Serializable id,
Object id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,

View File

@ -7,14 +7,13 @@
//$Id: CollectionInterceptor.java 7700 2005-07-30 05:02:47Z oneovthafew $
package org.hibernate.orm.test.interceptor;
import java.io.Serializable;
import org.hibernate.EmptyInterceptor;
import org.hibernate.Interceptor;
import org.hibernate.type.Type;
public class CollectionInterceptor extends EmptyInterceptor {
public class CollectionInterceptor implements Interceptor {
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) {
public boolean onFlushDirty(Object entity, Object id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) {
( (User) entity ).getActions().add("updated");
return false;
}

View File

@ -11,10 +11,10 @@
package org.hibernate.orm.test.interceptor;
import org.hibernate.CallbackException;
import org.hibernate.EmptyInterceptor;
import org.hibernate.Interceptor;
import org.hibernate.metamodel.RepresentationMode;
public class InstantiateInterceptor extends EmptyInterceptor {
public class InstantiateInterceptor implements Interceptor {
private String injectedString;
public InstantiateInterceptor(String injectedString) {

View File

@ -18,7 +18,7 @@ import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import org.hibernate.EmptyInterceptor;
import org.hibernate.Interceptor;
import org.hibernate.Session;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.resource.transaction.spi.TransactionStatus;
@ -205,7 +205,7 @@ public class InterceptorNonNullTransactionTest extends BaseJpaOrNativeBootstrapF
}
}
private class TransactionInterceptor extends EmptyInterceptor {
private class TransactionInterceptor implements Interceptor {
private boolean afterTransactionBeginMethodCalled;
private Boolean afterTransactionBeginAssertionPassed;

View File

@ -9,7 +9,6 @@ package org.hibernate.orm.test.interceptor;
import jakarta.persistence.PersistenceException;
import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.CriteriaQuery;
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
@ -18,7 +17,6 @@ import java.util.Queue;
import org.junit.Test;
import org.hibernate.AssertionFailure;
import org.hibernate.EmptyInterceptor;
import org.hibernate.Interceptor;
import org.hibernate.Session;
import org.hibernate.Transaction;
@ -108,11 +106,11 @@ public class InterceptorTest extends BaseCoreFunctionalTestCase {
s.close();
s = openSession(
new EmptyInterceptor() {
new Interceptor() {
@Override
public boolean onFlushDirty(
Object entity,
Serializable id,
Object id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
@ -180,7 +178,7 @@ public class InterceptorTest extends BaseCoreFunctionalTestCase {
final String checkComment = "generated from interceptor";
Session s = openSession(
new EmptyInterceptor() {
new Interceptor() {
@Override
public boolean onSave(
Object entity,

View File

@ -15,7 +15,6 @@
*/
package org.hibernate.orm.test.interceptor;
import org.hibernate.EmptyInterceptor;
import org.hibernate.Interceptor;
import org.hibernate.Session;
import org.hibernate.Transaction;
@ -44,7 +43,7 @@ public class InterceptorTransactionEventTest extends BaseCoreFunctionalTestCase
assertTrue("beforeTransactionCompletionCalled not called", interceptor.isBeforeTransactionCompletionCalled());
}
private static class LoggingInterceptor extends EmptyInterceptor {
private static class LoggingInterceptor implements Interceptor {
private boolean afterTransactionBeginCalled;
private boolean afterTransactionCompletionCalled;
private boolean beforeTransactionCompletionCalled;

View File

@ -7,16 +7,16 @@
//$Id: PropertyInterceptor.java 7700 2005-07-30 05:02:47Z oneovthafew $
package org.hibernate.orm.test.interceptor;
import java.io.Serializable;
import java.util.Calendar;
import org.hibernate.EmptyInterceptor;
import org.hibernate.Interceptor;
import org.hibernate.type.Type;
public class PropertyInterceptor extends EmptyInterceptor {
public class PropertyInterceptor implements Interceptor {
@Override
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) {
public boolean onFlushDirty(Object entity, Object id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) {
currentState[1] = Calendar.getInstance();
return true;
}

View File

@ -7,16 +7,16 @@
//$Id: StatefulInterceptor.java 7701 2005-07-30 05:07:01Z oneovthafew $
package org.hibernate.orm.test.interceptor;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.hibernate.EmptyInterceptor;
import org.hibernate.Interceptor;
import org.hibernate.Session;
import org.hibernate.type.Type;
public class StatefulInterceptor extends EmptyInterceptor {
public class StatefulInterceptor implements Interceptor {
private Session session;
@ -31,7 +31,7 @@ public class StatefulInterceptor extends EmptyInterceptor {
}
@Override
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) {
public boolean onFlushDirty(Object entity, Object id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) {
if ( !(entity instanceof Log) ) {
list.add( new Log( "update", (String) id, entity.getClass().getName() ) );
}

View File

@ -8,14 +8,10 @@
//$Id: DocumentInterceptor.java 7860 2005-08-11 21:58:23Z oneovthafew $
package org.hibernate.orm.test.interfaceproxy;
import java.io.Serializable;
import java.util.Calendar;
import java.util.Iterator;
import org.hibernate.CallbackException;
import org.hibernate.Interceptor;
import org.hibernate.Transaction;
import org.hibernate.metamodel.RepresentationMode;
import org.hibernate.type.Type;
/**
@ -23,14 +19,13 @@ import org.hibernate.type.Type;
*/
public class DocumentInterceptor implements Interceptor {
public boolean onLoad(Object entity, Serializable id, Object[] state,
String[] propertyNames, Type[] types) throws CallbackException {
return false;
}
public boolean onFlushDirty(Object entity, Serializable id,
Object[] currentState, Object[] previousState,
String[] propertyNames, Type[] types) throws CallbackException {
public boolean onFlushDirty(
Object entity,
Object id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
Type[] types) throws CallbackException {
if ( entity instanceof Document ) {
currentState[2] = Calendar.getInstance();
return true;
@ -40,8 +35,12 @@ public class DocumentInterceptor implements Interceptor {
}
}
public boolean onSave(Object entity, Object id, Object[] state,
String[] propertyNames, Type[] types) throws CallbackException {
public boolean onSave(
Object entity,
Object id,
Object[] state,
String[] propertyNames,
Type[] types) throws CallbackException {
if ( entity instanceof Document ) {
state[3] = state[2] = Calendar.getInstance();
return true;
@ -51,48 +50,12 @@ public class DocumentInterceptor implements Interceptor {
}
}
public void onDelete(Object entity, Serializable id, Object[] state,
String[] propertyNames, Type[] types) throws CallbackException {
public void onDelete(
Object entity,
Object id,
Object[] state,
String[] propertyNames,
Type[] types) throws CallbackException {
}
public void preFlush(Iterator entities) throws CallbackException {
}
public void postFlush(Iterator entities) throws CallbackException {
}
public Boolean isTransient(Object entity) {
return null;
}
public int[] findDirty(Object entity, Serializable id,
Object[] currentState, Object[] previousState,
String[] propertyNames, Type[] types) {
return null;
}
public Object instantiate(String entityName, RepresentationMode entityMode, Object id) throws CallbackException {
return null;
}
public String getEntityName(Object object) throws CallbackException {
return null;
}
public Object getEntity(String entityName, Serializable id)
throws CallbackException {
return null;
}
public void afterTransactionBegin(Transaction tx) {}
public void afterTransactionCompletion(Transaction tx) {}
public void beforeTransactionCompletion(Transaction tx) {}
public void onCollectionRecreate(Object collection, Serializable key) throws CallbackException {}
public void onCollectionRemove(Object collection, Serializable key) throws CallbackException {}
public void onCollectionUpdate(Object collection, Serializable key) throws CallbackException {}
}

View File

@ -6,8 +6,6 @@
*/
package org.hibernate.orm.test.jpa.callbacks;
import java.io.Serializable;
import java.nio.ByteBuffer;
import java.time.Instant;
import java.util.List;
import java.util.Objects;
@ -21,7 +19,7 @@ import jakarta.persistence.Lob;
import jakarta.persistence.PrePersist;
import jakarta.persistence.PreUpdate;
import org.hibernate.EmptyInterceptor;
import org.hibernate.Interceptor;
import org.hibernate.SessionBuilder;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.type.Type;
@ -67,14 +65,14 @@ public class PreUpdateDirtyCheckingInterceptorTest
} );
}
public static class OnFlushDirtyInterceptor extends EmptyInterceptor {
public static class OnFlushDirtyInterceptor implements Interceptor {
private static OnFlushDirtyInterceptor INSTANCE = new OnFlushDirtyInterceptor();
@Override
public int[] findDirty(
Object entity,
Serializable id,
Object id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,

View File

@ -8,16 +8,14 @@
//$Id$
package org.hibernate.orm.test.jpa.ejb3configuration;
import java.io.Serializable;
import org.hibernate.CallbackException;
import org.hibernate.EmptyInterceptor;
import org.hibernate.Interceptor;
import org.hibernate.type.Type;
/**
* @author Emmanuel Bernard
*/
public class ExceptionInterceptor extends EmptyInterceptor {
public class ExceptionInterceptor implements Interceptor {
public static final String EXCEPTION_MESSAGE = "Interceptor enabled";
protected boolean allowSave = false;
@ -30,7 +28,7 @@ public class ExceptionInterceptor extends EmptyInterceptor {
}
@Override
public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types)
public boolean onLoad(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types)
throws CallbackException {
throw new IllegalStateException( EXCEPTION_MESSAGE );
}

View File

@ -8,14 +8,10 @@
//$Id: DocumentInterceptor.java 8670 2005-11-25 17:36:29Z epbernard $
package org.hibernate.orm.test.mixed;
import java.io.Serializable;
import java.util.Calendar;
import java.util.Iterator;
import org.hibernate.CallbackException;
import org.hibernate.Interceptor;
import org.hibernate.Transaction;
import org.hibernate.metamodel.RepresentationMode;
import org.hibernate.type.Type;
/**
@ -23,19 +19,13 @@ import org.hibernate.type.Type;
*/
public class DocumentInterceptor implements Interceptor {
public boolean onLoad(
Object entity, Serializable id, Object[] state,
String[] propertyNames, Type[] types
) throws CallbackException {
return false;
}
public boolean onFlushDirty(
Object entity, Serializable id,
Object[] currentState, Object[] previousState,
String[] propertyNames, Type[] types
) throws CallbackException {
Object entity,
Object id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
Type[] types) throws CallbackException {
if ( entity instanceof Document ) {
currentState[3] = Calendar.getInstance();
return true;
@ -46,9 +36,11 @@ public class DocumentInterceptor implements Interceptor {
}
public boolean onSave(
Object entity, Object id, Object[] state,
String[] propertyNames, Type[] types
) throws CallbackException {
Object entity,
Object id,
Object[] state,
String[] propertyNames,
Type[] types) throws CallbackException {
if ( entity instanceof Document ) {
state[4] = state[3] = Calendar.getInstance();
return true;
@ -59,60 +51,11 @@ public class DocumentInterceptor implements Interceptor {
}
public void onDelete(
Object entity, Serializable id, Object[] state,
String[] propertyNames, Type[] types
) throws CallbackException {
Object entity,
Object id,
Object[] state,
String[] propertyNames,
Type[] types) throws CallbackException {
}
public void preFlush(Iterator entities) throws CallbackException {
}
public void postFlush(Iterator entities) throws CallbackException {
}
public Boolean isTransient(Object entity) {
return null;
}
public int[] findDirty(
Object entity, Serializable id,
Object[] currentState, Object[] previousState,
String[] propertyNames, Type[] types
) {
return null;
}
public Object instantiate(String entityName, RepresentationMode entityMode, Object id) throws CallbackException {
return null;
}
public String getEntityName(Object object) throws CallbackException {
return null;
}
public Object getEntity(String entityName, Serializable id)
throws CallbackException {
return null;
}
public void afterTransactionBegin(Transaction tx) {
}
public void afterTransactionCompletion(Transaction tx) {
}
public void beforeTransactionCompletion(Transaction tx) {
}
public void onCollectionRecreate(Object collection, Serializable key) throws CallbackException {
}
public void onCollectionRemove(Object collection, Serializable key) throws CallbackException {
}
public void onCollectionUpdate(Object collection, Serializable key) throws CallbackException {
}
}

View File

@ -6,21 +6,17 @@
*/
package org.hibernate.orm.test.querycache;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import org.hibernate.EmptyInterceptor;
import org.hibernate.Hibernate;
import org.hibernate.Interceptor;
import org.hibernate.Session;
import org.hibernate.SessionBuilder;
import org.hibernate.Transaction;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.query.NativeQuery;
import org.hibernate.query.Query;
@ -724,17 +720,11 @@ public class QueryCacheTest {
}
}
public class DelayLoadOperations extends EmptyInterceptor {
public class DelayLoadOperations implements Interceptor {
private volatile CountDownLatch blockLatch;
private volatile CountDownLatch waitLatch;
@Override
public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) {
onLoad();
return true;
}
@Override
public boolean onLoad(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types){
onLoad();

View File

@ -15,7 +15,7 @@ import jakarta.persistence.Id;
import jakarta.transaction.Status;
import org.hibernate.EmptyInterceptor;
import org.hibernate.Interceptor;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AvailableSettings;
@ -307,7 +307,7 @@ public class InterceptorTransactionTest extends BaseJpaOrNativeBootstrapFunction
}
}
private class TransactionInterceptor extends EmptyInterceptor {
private class TransactionInterceptor implements Interceptor {
private boolean afterTransactionBeginMethodCalled;
private Boolean afterTransactionBeginAssertionPassed;

View File

@ -9,7 +9,7 @@ package org.hibernate.envers.test.integration.tm;
import java.util.HashMap;
import java.util.Map;
import org.hibernate.EmptyInterceptor;
import org.hibernate.Interceptor;
import org.hibernate.Transaction;
import org.jboss.logging.Logger;
@ -17,7 +17,7 @@ import org.jboss.logging.Logger;
/**
* @author Chris Cranford
*/
public class TestInterceptor extends EmptyInterceptor {
public class TestInterceptor implements Interceptor {
private static final Logger LOGGER = Logger.getLogger( TestInterceptor.class );
private static Map<TestInterceptor, Integer> interceptorInvocations = new HashMap<>();
@ -28,7 +28,6 @@ public class TestInterceptor extends EmptyInterceptor {
@Override
public void beforeTransactionCompletion(Transaction tx) {
super.beforeTransactionCompletion(tx);
interceptorInvocations.put( this, interceptorInvocations.get( this ) + 1 );
LOGGER.info( "Interceptor beforeTransactionCompletion invoked" );
}

View File

@ -267,7 +267,15 @@ XML processing.
* Removed `org.hibernate.annotations.CascadeType.DELETE` in favor of `org.hibernate.annotations.CascadeType#REMOVE`
* Removed the attribute value from `@DynamicInsert` and `@DynamicUpdate`
* Removed `org.hibernate.integrator.spi.Integrator#integrate(Metadata,SessionFactoryImplementor,SessionFactoryServiceRegistry)` in favor of `org.hibernate.integrator.spi.Integrator#integrate(Metadata,BootstrapContext,SessionFactoryImplementor)`
* Removed `org.hibernate.Interceptor#onLoad(Object, Serializable, Object[] , String[] , Type[] )` in favour of `org.hibernate.Interceptor#onLoad(Object, Object, Object[], String[], Type[] )`
* Removed `org.hibernate.Interceptor#onFlushDirty(Object, Serializable, Object[] , Object[], String[] , Type[] )` in favour of `org.hibernate.Interceptor#onLoad(Object, Object, Object[], Object[], String[] , Type[] )`
* Removed `org.hibernate.Interceptor#onSave(Object, Serializable, Object[], String[], Type[])` in favour of `org.hibernate.Interceptor#onSave(Object, Object, Object[], String[], Type[])`
* Removed `org.hibernate.Interceptor#onDelete(Object, Serializable, Object[], String[], Type[])` in favour of `org.hibernate.Interceptor#onDelete(Object, Serializable, Object[], String[], Type[])`
* Removed `org.hibernate.Interceptor#onCollectionRecreate(Object, Serializable)` in favour of `org.hibernate.Interceptor#onCollectionRecreate(Object, Object)`
* Removed `org.hibernate.Interceptor#onCollectionRemove(Object, Serializable)` in favour of `org.hibernate.Interceptor#onCollectionRemove(Object, Object)`
* Removed `org.hibernate.Interceptor#onCollectionUpdate(Object, Serializable)` in favour of `org.hibernate.Interceptor#onCollectionUpdate(Object, Object)`
* Removed `org.hibernate.Interceptor#findDirty(Object, Serializable, Object[], Object[], String[], Type[])` in favour of `org.hibernate.Interceptor#findDirty(Object, Object, Object[], Object[], String[], Type[])`
* Removed `org.hibernate.Interceptor#getEntity(String, Serializable)` in favour of `org.hibernate.Interceptor#getEntity(String, Serializable)`
[[todo]]
== Todos (dev)