HHH-15803 Have the default EmptyInterceptor avoid triggering type pollution
This commit is contained in:
parent
721b66c6d3
commit
c114d08ac2
|
@ -20,10 +20,7 @@ import org.hibernate.type.Type;
|
|||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
public class EmptyInterceptor implements Interceptor, Serializable {
|
||||
/**
|
||||
* The singleton reference.
|
||||
*/
|
||||
public static final Interceptor INSTANCE = new EmptyInterceptor();
|
||||
|
||||
protected EmptyInterceptor() {}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ import java.util.concurrent.Callable;
|
|||
import java.util.function.Supplier;
|
||||
|
||||
import org.hibernate.CustomEntityDirtinessStrategy;
|
||||
import org.hibernate.EmptyInterceptor;
|
||||
import org.hibernate.EntityNameResolver;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Interceptor;
|
||||
|
@ -48,6 +47,7 @@ import org.hibernate.engine.jdbc.env.spi.ExtractedDatabaseMetaData;
|
|||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||
import org.hibernate.id.uuid.LocalObjectUuidHelper;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.EmptyInterceptor;
|
||||
import org.hibernate.internal.util.NullnessHelper;
|
||||
import org.hibernate.internal.util.PropertiesHelper;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
|
|
|
@ -16,7 +16,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.hibernate.EmptyInterceptor;
|
||||
import org.hibernate.EntityNameResolver;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Interceptor;
|
||||
|
@ -51,6 +50,7 @@ import org.hibernate.cfg.annotations.NamedEntityGraphDefinition;
|
|||
import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.EmptyInterceptor;
|
||||
import org.hibernate.proxy.EntityNotFoundDelegate;
|
||||
import org.hibernate.query.sqm.function.SqmFunctionDescriptor;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
package org.hibernate.event.internal;
|
||||
|
||||
import org.hibernate.CacheMode;
|
||||
import org.hibernate.EmptyInterceptor;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.TransientObjectException;
|
||||
|
@ -35,6 +34,7 @@ import org.hibernate.event.spi.DeleteEventListener;
|
|||
import org.hibernate.event.spi.EventSource;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.EmptyInterceptor;
|
||||
import org.hibernate.internal.FastSessionServices;
|
||||
import org.hibernate.jpa.event.spi.CallbackRegistry;
|
||||
import org.hibernate.jpa.event.spi.CallbackRegistryConsumer;
|
||||
|
|
|
@ -17,7 +17,6 @@ import java.util.UUID;
|
|||
import java.util.function.Function;
|
||||
|
||||
import org.hibernate.CacheMode;
|
||||
import org.hibernate.EmptyInterceptor;
|
||||
import org.hibernate.EntityNameResolver;
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.HibernateException;
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.internal;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.hibernate.Interceptor;
|
||||
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.
|
||||
*
|
||||
* Implementors of Interceptor don't need a base class anymore since we now have default
|
||||
* implementations of the contract defined in the interface.
|
||||
*/
|
||||
public final class EmptyInterceptor implements Interceptor, Serializable {
|
||||
|
||||
public static final Interceptor INSTANCE = new EmptyInterceptor();
|
||||
|
||||
private EmptyInterceptor() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLoad(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onFlushDirty(
|
||||
Object entity,
|
||||
Object id,
|
||||
Object[] currentState,
|
||||
Object[] previousState,
|
||||
String[] propertyNames,
|
||||
Type[] types) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSave(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDelete(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] findDirty(
|
||||
Object entity,
|
||||
Object id,
|
||||
Object[] currentState,
|
||||
Object[] previousState,
|
||||
String[] propertyNames,
|
||||
Type[] types) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getEntity(String entityName, Object id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -34,7 +34,6 @@ import jakarta.persistence.Query;
|
|||
import jakarta.persistence.SynchronizationType;
|
||||
|
||||
import org.hibernate.CustomEntityDirtinessStrategy;
|
||||
import org.hibernate.EmptyInterceptor;
|
||||
import org.hibernate.EntityNameResolver;
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.HibernateException;
|
||||
|
|
Loading…
Reference in New Issue