HHH-6845 Avoid repeated invocations of ReflectHelper.overridesEquals in proxy initializers
This commit is contained in:
parent
b4e65a0c79
commit
f5702548bb
|
@ -57,13 +57,14 @@ public abstract class BasicLazyInitializer extends AbstractLazyInitializer {
|
||||||
Method getIdentifierMethod,
|
Method getIdentifierMethod,
|
||||||
Method setIdentifierMethod,
|
Method setIdentifierMethod,
|
||||||
CompositeType componentIdType,
|
CompositeType componentIdType,
|
||||||
SessionImplementor session) {
|
SessionImplementor session,
|
||||||
|
boolean overridesEquals) {
|
||||||
super(entityName, id, session);
|
super(entityName, id, session);
|
||||||
this.persistentClass = persistentClass;
|
this.persistentClass = persistentClass;
|
||||||
this.getIdentifierMethod = getIdentifierMethod;
|
this.getIdentifierMethod = getIdentifierMethod;
|
||||||
this.setIdentifierMethod = setIdentifierMethod;
|
this.setIdentifierMethod = setIdentifierMethod;
|
||||||
this.componentIdType = componentIdType;
|
this.componentIdType = componentIdType;
|
||||||
overridesEquals = ReflectHelper.overridesEquals(persistentClass);
|
this.overridesEquals = overridesEquals;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract Object serializableProxy();
|
protected abstract Object serializableProxy();
|
||||||
|
|
|
@ -69,8 +69,9 @@ public class JavassistLazyInitializer extends BasicLazyInitializer implements Me
|
||||||
final Method getIdentifierMethod,
|
final Method getIdentifierMethod,
|
||||||
final Method setIdentifierMethod,
|
final Method setIdentifierMethod,
|
||||||
final CompositeType componentIdType,
|
final CompositeType componentIdType,
|
||||||
final SessionImplementor session) {
|
final SessionImplementor session,
|
||||||
super( entityName, persistentClass, id, getIdentifierMethod, setIdentifierMethod, componentIdType, session );
|
final boolean overridesEquals) {
|
||||||
|
super( entityName, persistentClass, id, getIdentifierMethod, setIdentifierMethod, componentIdType, session, overridesEquals );
|
||||||
this.interfaces = interfaces;
|
this.interfaces = interfaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +94,8 @@ public class JavassistLazyInitializer extends BasicLazyInitializer implements Me
|
||||||
getIdentifierMethod,
|
getIdentifierMethod,
|
||||||
setIdentifierMethod,
|
setIdentifierMethod,
|
||||||
componentIdType,
|
componentIdType,
|
||||||
session
|
session,
|
||||||
|
ReflectHelper.overridesEquals(persistentClass)
|
||||||
);
|
);
|
||||||
ProxyFactory factory = new ProxyFactory();
|
ProxyFactory factory = new ProxyFactory();
|
||||||
factory.setSuperclass( interfaces.length == 1 ? persistentClass : null );
|
factory.setSuperclass( interfaces.length == 1 ? persistentClass : null );
|
||||||
|
@ -120,7 +122,8 @@ public class JavassistLazyInitializer extends BasicLazyInitializer implements Me
|
||||||
final Method setIdentifierMethod,
|
final Method setIdentifierMethod,
|
||||||
final CompositeType componentIdType,
|
final CompositeType componentIdType,
|
||||||
final Serializable id,
|
final Serializable id,
|
||||||
final SessionImplementor session) throws HibernateException {
|
final SessionImplementor session,
|
||||||
|
final boolean classOverridesEquals) throws HibernateException {
|
||||||
|
|
||||||
final JavassistLazyInitializer instance = new JavassistLazyInitializer(
|
final JavassistLazyInitializer instance = new JavassistLazyInitializer(
|
||||||
entityName,
|
entityName,
|
||||||
|
@ -129,7 +132,8 @@ public class JavassistLazyInitializer extends BasicLazyInitializer implements Me
|
||||||
getIdentifierMethod,
|
getIdentifierMethod,
|
||||||
setIdentifierMethod,
|
setIdentifierMethod,
|
||||||
componentIdType,
|
componentIdType,
|
||||||
session
|
session,
|
||||||
|
classOverridesEquals
|
||||||
);
|
);
|
||||||
|
|
||||||
final HibernateProxy proxy;
|
final HibernateProxy proxy;
|
||||||
|
|
|
@ -28,6 +28,7 @@ import java.util.Set;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.engine.spi.SessionImplementor;
|
import org.hibernate.engine.spi.SessionImplementor;
|
||||||
|
import org.hibernate.internal.util.ReflectHelper;
|
||||||
import org.hibernate.proxy.HibernateProxy;
|
import org.hibernate.proxy.HibernateProxy;
|
||||||
import org.hibernate.proxy.ProxyFactory;
|
import org.hibernate.proxy.ProxyFactory;
|
||||||
import org.hibernate.type.CompositeType;
|
import org.hibernate.type.CompositeType;
|
||||||
|
@ -47,6 +48,7 @@ public class JavassistProxyFactory implements ProxyFactory, Serializable {
|
||||||
private Method setIdentifierMethod;
|
private Method setIdentifierMethod;
|
||||||
private CompositeType componentIdType;
|
private CompositeType componentIdType;
|
||||||
private Class factory;
|
private Class factory;
|
||||||
|
private boolean overridesEquals;
|
||||||
|
|
||||||
public void postInstantiate(
|
public void postInstantiate(
|
||||||
final String entityName,
|
final String entityName,
|
||||||
|
@ -62,6 +64,7 @@ public class JavassistProxyFactory implements ProxyFactory, Serializable {
|
||||||
this.setIdentifierMethod = setIdentifierMethod;
|
this.setIdentifierMethod = setIdentifierMethod;
|
||||||
this.componentIdType = componentIdType;
|
this.componentIdType = componentIdType;
|
||||||
factory = JavassistLazyInitializer.getProxyFactory( persistentClass, this.interfaces );
|
factory = JavassistLazyInitializer.getProxyFactory( persistentClass, this.interfaces );
|
||||||
|
overridesEquals = ReflectHelper.overridesEquals(persistentClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HibernateProxy getProxy(
|
public HibernateProxy getProxy(
|
||||||
|
@ -76,7 +79,8 @@ public class JavassistProxyFactory implements ProxyFactory, Serializable {
|
||||||
setIdentifierMethod,
|
setIdentifierMethod,
|
||||||
componentIdType,
|
componentIdType,
|
||||||
id,
|
id,
|
||||||
session
|
session,
|
||||||
|
overridesEquals
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue