parent
3f073ae551
commit
a4cb390552
|
@ -19,5 +19,5 @@ public interface BeforeTransactionCompletionProcess {
|
|||
*
|
||||
* @param session The session on which the transaction is preparing to complete.
|
||||
*/
|
||||
public void doBeforeTransactionCompletion(SessionImplementor session);
|
||||
void doBeforeTransactionCompletion(SessionImplementor session);
|
||||
}
|
||||
|
|
|
@ -22,12 +22,11 @@ final class DisallowedProxyFactory implements ProxyFactory {
|
|||
@Override
|
||||
public void postInstantiate(
|
||||
String entityName,
|
||||
Class persistentClass,
|
||||
Set<Class> interfaces,
|
||||
Class<?> persistentClass,
|
||||
Set<Class<?>> interfaces,
|
||||
Method getIdentifierMethod,
|
||||
Method setIdentifierMethod,
|
||||
CompositeType componentIdType) throws HibernateException {
|
||||
|
||||
CompositeType componentIdType) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1083,24 +1083,26 @@ public class SessionFactoryImpl implements SessionFactoryImplementor {
|
|||
return fetchProfiles.get( name );
|
||||
}
|
||||
|
||||
@Override @SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> BindableType<? extends T> resolveParameterBindType(T bindValue) {
|
||||
if ( bindValue == null ) {
|
||||
// we can't guess
|
||||
return null;
|
||||
}
|
||||
|
||||
Class<? extends T> clazz;
|
||||
Class<?> clazz;
|
||||
if (bindValue instanceof HibernateProxy) {
|
||||
HibernateProxy proxy = (HibernateProxy) bindValue;
|
||||
LazyInitializer li = proxy.getHibernateLazyInitializer();
|
||||
clazz = li.getPersistentClass();
|
||||
}
|
||||
else {
|
||||
clazz = (Class<? extends T>) bindValue.getClass();
|
||||
clazz = bindValue.getClass();
|
||||
}
|
||||
|
||||
return resolveParameterBindType( clazz );
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends T> c = (Class<? extends T>) clazz;
|
||||
return resolveParameterBindType( c );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -182,10 +182,10 @@ public class EntityRepresentationStrategyPojoStandard implements EntityRepresent
|
|||
BytecodeProvider bytecodeProvider,
|
||||
RuntimeModelCreationContext creationContext) {
|
||||
|
||||
final Set<Class> proxyInterfaces = new java.util.HashSet<>();
|
||||
final Set<Class<?>> proxyInterfaces = new java.util.HashSet<>();
|
||||
|
||||
final Class mappedClass = mappedJtd.getJavaTypeClass();
|
||||
Class proxyInterface;
|
||||
final Class<?> mappedClass = mappedJtd.getJavaTypeClass();
|
||||
Class<?> proxyInterface;
|
||||
if ( proxyJtd != null ) {
|
||||
proxyInterface = proxyJtd.getJavaTypeClass();
|
||||
}
|
||||
|
@ -206,12 +206,11 @@ public class EntityRepresentationStrategyPojoStandard implements EntityRepresent
|
|||
proxyInterfaces.add( mappedClass );
|
||||
}
|
||||
|
||||
//noinspection unchecked
|
||||
final Iterator<Subclass> subclasses = bootDescriptor.getSubclassIterator();
|
||||
while ( subclasses.hasNext() ) {
|
||||
final Subclass subclass = subclasses.next();
|
||||
final Class subclassProxy = subclass.getProxyInterface();
|
||||
final Class subclassClass = subclass.getMappedClass();
|
||||
final Class<?> subclassProxy = subclass.getProxyInterface();
|
||||
final Class<?> subclassClass = subclass.getMappedClass();
|
||||
if ( subclassProxy != null && !subclassClass.equals( subclassProxy ) ) {
|
||||
if ( !subclassProxy.isInterface() ) {
|
||||
throw new MappingException(
|
||||
|
@ -224,8 +223,8 @@ public class EntityRepresentationStrategyPojoStandard implements EntityRepresent
|
|||
|
||||
proxyInterfaces.add( HibernateProxy.class );
|
||||
|
||||
Iterator properties = bootDescriptor.getPropertyIterator();
|
||||
Class clazz = bootDescriptor.getMappedClass();
|
||||
Iterator<?> properties = bootDescriptor.getPropertyIterator();
|
||||
Class<?> clazz = bootDescriptor.getMappedClass();
|
||||
final Method idGetterMethod;
|
||||
final Method idSetterMethod;
|
||||
|
||||
|
@ -294,8 +293,8 @@ public class EntityRepresentationStrategyPojoStandard implements EntityRepresent
|
|||
private ReflectionOptimizer resolveReflectionOptimizer(
|
||||
PersistentClass bootType,
|
||||
BytecodeProvider bytecodeProvider,
|
||||
@SuppressWarnings("unused") SessionFactoryImplementor sessionFactory) {
|
||||
final Class javaTypeToReflect;
|
||||
SessionFactoryImplementor sessionFactory) {
|
||||
final Class<?> javaTypeToReflect;
|
||||
if ( proxyFactory != null ) {
|
||||
assert proxyJtd != null;
|
||||
javaTypeToReflect = proxyJtd.getJavaTypeClass();
|
||||
|
@ -306,13 +305,11 @@ public class EntityRepresentationStrategyPojoStandard implements EntityRepresent
|
|||
|
||||
final List<String> getterNames = new ArrayList<>();
|
||||
final List<String> setterNames = new ArrayList<>();
|
||||
final List<Class> getterTypes = new ArrayList<>();
|
||||
final List<Class<?>> getterTypes = new ArrayList<>();
|
||||
|
||||
boolean foundCustomAccessor = false;
|
||||
|
||||
//noinspection unchecked
|
||||
final Iterator<Property> itr = bootType.getPropertyClosureIterator();
|
||||
int i = 0;
|
||||
while ( itr.hasNext() ) {
|
||||
//TODO: redesign how PropertyAccessors are acquired...
|
||||
final Property property = itr.next();
|
||||
|
@ -328,8 +325,6 @@ public class EntityRepresentationStrategyPojoStandard implements EntityRepresent
|
|||
getterTypes.add( propertyAccess.getGetter().getReturnTypeClass() );
|
||||
|
||||
setterNames.add( propertyAccess.getSetter().getMethodName() );
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
if ( foundCustomAccessor || ! Environment.useReflectionOptimizer() ) {
|
||||
|
|
|
@ -40,7 +40,7 @@ public final class MessageHelper {
|
|||
public static String infoString(String entityName, Object id) {
|
||||
StringBuilder s = new StringBuilder();
|
||||
s.append( '[' );
|
||||
if( entityName == null ) {
|
||||
if ( entityName == null ) {
|
||||
s.append( "<null entity name>" );
|
||||
}
|
||||
else {
|
||||
|
@ -237,7 +237,7 @@ public final class MessageHelper {
|
|||
*/
|
||||
public static String collectionInfoString(
|
||||
CollectionPersister persister,
|
||||
PersistentCollection collection,
|
||||
PersistentCollection<?> collection,
|
||||
Object collectionKey,
|
||||
SharedSessionContractImplementor session ) {
|
||||
|
||||
|
@ -360,7 +360,7 @@ public final class MessageHelper {
|
|||
else {
|
||||
// TODO: This is a crappy backup if a property-ref is used.
|
||||
// If the reference is an object w/o toString(), this isn't going to work.
|
||||
s.append( id.toString() );
|
||||
s.append( id );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ public class PropertyAccessStrategyResolverStandardImpl implements PropertyAcces
|
|||
|
||||
@Override
|
||||
public PropertyAccessStrategy resolvePropertyAccessStrategy(
|
||||
Class containerClass,
|
||||
Class<?> containerClass,
|
||||
String explicitAccessStrategyName,
|
||||
RepresentationMode representationMode) {
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ import org.hibernate.engine.spi.CompositeOwner;
|
|||
import org.hibernate.engine.spi.CompositeTracker;
|
||||
import org.hibernate.engine.spi.PersistentAttributeInterceptable;
|
||||
import org.hibernate.engine.spi.PersistentAttributeInterceptor;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.property.access.internal.AbstractFieldSerialForm;
|
||||
|
||||
/**
|
||||
|
@ -29,8 +28,7 @@ import org.hibernate.property.access.internal.AbstractFieldSerialForm;
|
|||
public class EnhancedSetterImpl extends SetterFieldImpl {
|
||||
private final String propertyName;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public EnhancedSetterImpl(Class containerClass, String propertyName, Field field) {
|
||||
public EnhancedSetterImpl(Class<?> containerClass, String propertyName, Field field) {
|
||||
super( containerClass, propertyName, field );
|
||||
this.propertyName = propertyName;
|
||||
}
|
||||
|
|
|
@ -25,12 +25,12 @@ import org.hibernate.property.access.internal.AbstractFieldSerialForm;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class GetterFieldImpl implements Getter {
|
||||
private final Class containerClass;
|
||||
private final Class<?> containerClass;
|
||||
private final String propertyName;
|
||||
private final Field field;
|
||||
private final Method getterMethod;
|
||||
|
||||
public GetterFieldImpl(Class containerClass, String propertyName, Field field) {
|
||||
public GetterFieldImpl(Class<?> containerClass, String propertyName, Field field) {
|
||||
this.containerClass = containerClass;
|
||||
this.propertyName = propertyName;
|
||||
this.field = field;
|
||||
|
@ -51,22 +51,22 @@ public class GetterFieldImpl implements Getter {
|
|||
Class<?> type = field.getType();
|
||||
if ( type.isPrimitive() ) {
|
||||
if ( type == Boolean.TYPE ) {
|
||||
return Boolean.valueOf( field.getBoolean( owner ) );
|
||||
return field.getBoolean(owner);
|
||||
}
|
||||
else if ( type == Byte.TYPE ) {
|
||||
return Byte.valueOf( field.getByte( owner ) );
|
||||
return field.getByte(owner);
|
||||
}
|
||||
else if ( type == Character.TYPE ) {
|
||||
return Character.valueOf( field.getChar( owner ) );
|
||||
return field.getChar(owner);
|
||||
}
|
||||
else if ( type == Integer.TYPE ) {
|
||||
return Integer.valueOf( field.getInt( owner ) );
|
||||
return field.getInt(owner);
|
||||
}
|
||||
else if ( type == Long.TYPE ) {
|
||||
return Long.valueOf( field.getLong( owner ) );
|
||||
return field.getLong(owner);
|
||||
}
|
||||
else if ( type == Short.TYPE ) {
|
||||
return Short.valueOf( field.getShort( owner ) );
|
||||
return field.getShort(owner);
|
||||
}
|
||||
}
|
||||
return field.get( owner );
|
||||
|
@ -121,10 +121,10 @@ public class GetterFieldImpl implements Getter {
|
|||
}
|
||||
|
||||
private static class SerialForm extends AbstractFieldSerialForm implements Serializable {
|
||||
private final Class containerClass;
|
||||
private final Class<?> containerClass;
|
||||
private final String propertyName;
|
||||
|
||||
private SerialForm(Class containerClass, String propertyName, Field field) {
|
||||
private SerialForm(Class<?> containerClass, String propertyName, Field field) {
|
||||
super( field );
|
||||
this.containerClass = containerClass;
|
||||
this.propertyName = propertyName;
|
||||
|
|
|
@ -28,11 +28,11 @@ import static org.hibernate.internal.CoreLogging.messageLogger;
|
|||
public class GetterMethodImpl implements Getter {
|
||||
private static final CoreMessageLogger LOG = messageLogger( GetterMethodImpl.class );
|
||||
|
||||
private final Class containerClass;
|
||||
private final Class<?> containerClass;
|
||||
private final String propertyName;
|
||||
private final Method getterMethod;
|
||||
|
||||
public GetterMethodImpl(Class containerClass, String propertyName, Method getterMethod) {
|
||||
public GetterMethodImpl(Class<?> containerClass, String propertyName, Method getterMethod) {
|
||||
this.containerClass = containerClass;
|
||||
this.propertyName = propertyName;
|
||||
this.getterMethod = getterMethod;
|
||||
|
@ -109,13 +109,13 @@ public class GetterMethodImpl implements Getter {
|
|||
}
|
||||
|
||||
private static class SerialForm implements Serializable {
|
||||
private final Class containerClass;
|
||||
private final Class<?> containerClass;
|
||||
private final String propertyName;
|
||||
|
||||
private final Class declaringClass;
|
||||
private final Class<?> declaringClass;
|
||||
private final String methodName;
|
||||
|
||||
private SerialForm(Class containerClass, String propertyName, Method method) {
|
||||
private SerialForm(Class<?> containerClass, String propertyName, Method method) {
|
||||
this.containerClass = containerClass;
|
||||
this.propertyName = propertyName;
|
||||
this.declaringClass = method.getDeclaringClass();
|
||||
|
@ -126,7 +126,6 @@ public class GetterMethodImpl implements Getter {
|
|||
return new GetterMethodImpl( containerClass, propertyName, resolveMethod() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Method resolveMethod() {
|
||||
try {
|
||||
final Method method = declaringClass.getDeclaredMethod( methodName );
|
||||
|
|
|
@ -27,7 +27,7 @@ public interface PropertyAccessStrategyResolver extends Service {
|
|||
* @return The resolved PropertyAccessStrategy
|
||||
*/
|
||||
PropertyAccessStrategy resolvePropertyAccessStrategy(
|
||||
Class containerClass,
|
||||
Class<?> containerClass,
|
||||
String explicitAccessStrategyName,
|
||||
RepresentationMode representationMode);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import java.lang.reflect.Method;
|
|||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.PropertyAccessException;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.property.access.internal.AbstractFieldSerialForm;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
|
@ -23,19 +22,19 @@ import org.hibernate.proxy.HibernateProxy;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class SetterFieldImpl implements Setter {
|
||||
private final Class containerClass;
|
||||
private final Class<?> containerClass;
|
||||
private final String propertyName;
|
||||
private final Field field;
|
||||
private final Method setterMethod;
|
||||
|
||||
public SetterFieldImpl(Class containerClass, String propertyName, Field field) {
|
||||
public SetterFieldImpl(Class<?> containerClass, String propertyName, Field field) {
|
||||
this.containerClass = containerClass;
|
||||
this.propertyName = propertyName;
|
||||
this.field = field;
|
||||
this.setterMethod = ReflectHelper.setterMethodOrNull( containerClass, propertyName, field.getType() );
|
||||
}
|
||||
|
||||
public Class getContainerClass() {
|
||||
public Class<?> getContainerClass() {
|
||||
return containerClass;
|
||||
}
|
||||
|
||||
|
@ -105,11 +104,11 @@ public class SetterFieldImpl implements Setter {
|
|||
}
|
||||
|
||||
private static class SerialForm extends AbstractFieldSerialForm implements Serializable {
|
||||
private final Class containerClass;
|
||||
private final Class<?> containerClass;
|
||||
private final String propertyName;
|
||||
|
||||
|
||||
private SerialForm(Class containerClass, String propertyName, Field field) {
|
||||
private SerialForm(Class<?> containerClass, String propertyName, Field field) {
|
||||
super( field );
|
||||
this.containerClass = containerClass;
|
||||
this.propertyName = propertyName;
|
||||
|
|
|
@ -23,13 +23,13 @@ import static org.hibernate.internal.CoreLogging.messageLogger;
|
|||
public class SetterMethodImpl implements Setter {
|
||||
private static final CoreMessageLogger LOG = messageLogger( SetterMethodImpl.class );
|
||||
|
||||
private final Class containerClass;
|
||||
private final Class<?> containerClass;
|
||||
private final String propertyName;
|
||||
private final Method setterMethod;
|
||||
|
||||
private final boolean isPrimitive;
|
||||
|
||||
public SetterMethodImpl(Class containerClass, String propertyName, Method setterMethod) {
|
||||
public SetterMethodImpl(Class<?> containerClass, String propertyName, Method setterMethod) {
|
||||
this.containerClass = containerClass;
|
||||
this.propertyName = propertyName;
|
||||
this.setterMethod = setterMethod;
|
||||
|
@ -92,7 +92,7 @@ public class SetterMethodImpl implements Setter {
|
|||
);
|
||||
}
|
||||
else {
|
||||
final Class expectedType = setterMethod.getParameterTypes()[0];
|
||||
final Class<?> expectedType = setterMethod.getParameterTypes()[0];
|
||||
LOG.illegalPropertySetterArgument( containerClass.getName(), propertyName );
|
||||
LOG.expectedType( expectedType.getName(), value == null ? null : value.getClass().getName() );
|
||||
throw new PropertySetterAccessException(
|
||||
|
@ -122,14 +122,14 @@ public class SetterMethodImpl implements Setter {
|
|||
}
|
||||
|
||||
private static class SerialForm implements Serializable {
|
||||
private final Class containerClass;
|
||||
private final Class<?> containerClass;
|
||||
private final String propertyName;
|
||||
|
||||
private final Class declaringClass;
|
||||
private final Class<?> declaringClass;
|
||||
private final String methodName;
|
||||
private final Class argumentType;
|
||||
private final Class<?> argumentType;
|
||||
|
||||
private SerialForm(Class containerClass, String propertyName, Method method) {
|
||||
private SerialForm(Class<?> containerClass, String propertyName, Method method) {
|
||||
this.containerClass = containerClass;
|
||||
this.propertyName = propertyName;
|
||||
this.declaringClass = method.getDeclaringClass();
|
||||
|
@ -141,7 +141,6 @@ public class SetterMethodImpl implements Setter {
|
|||
return new SetterMethodImpl( containerClass, propertyName, resolveMethod() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Method resolveMethod() {
|
||||
try {
|
||||
final Method method = declaringClass.getDeclaredMethod( methodName, argumentType );
|
||||
|
|
|
@ -18,12 +18,12 @@ public interface HibernateProxy extends Serializable {
|
|||
*
|
||||
* @return The serializable proxy replacement.
|
||||
*/
|
||||
public Object writeReplace();
|
||||
Object writeReplace();
|
||||
|
||||
/**
|
||||
* Get the underlying lazy initialization handler.
|
||||
*
|
||||
* @return The lazy initializer.
|
||||
*/
|
||||
public LazyInitializer getHibernateLazyInitializer();
|
||||
LazyInitializer getHibernateLazyInitializer();
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public interface LazyInitializer {
|
|||
*
|
||||
* @return The actual entity class.
|
||||
*/
|
||||
Class getPersistentClass();
|
||||
Class<?> getPersistentClass();
|
||||
|
||||
/**
|
||||
* Is the proxy uninitialized?
|
||||
|
|
|
@ -46,8 +46,8 @@ public interface ProxyFactory {
|
|||
*/
|
||||
void postInstantiate(
|
||||
String entityName,
|
||||
Class persistentClass,
|
||||
Set<Class> interfaces,
|
||||
Class<?> persistentClass,
|
||||
Set<Class<?>> interfaces,
|
||||
Method getIdentifierMethod,
|
||||
Method setIdentifierMethod,
|
||||
CompositeType componentIdType) throws HibernateException;
|
||||
|
|
|
@ -23,11 +23,12 @@ public class MapLazyInitializer extends AbstractLazyInitializer implements Seria
|
|||
super( entityName, id, session );
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Map getMap() {
|
||||
return (Map) getImplementation();
|
||||
}
|
||||
|
||||
public Class getPersistentClass() {
|
||||
public Class<?> getPersistentClass() {
|
||||
throw new UnsupportedOperationException("dynamic-map entity representation");
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.proxy.map;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
@ -20,7 +21,7 @@ import org.hibernate.proxy.LazyInitializer;
|
|||
*/
|
||||
public class MapProxy implements HibernateProxy, Map, Serializable {
|
||||
|
||||
private MapLazyInitializer li;
|
||||
private final MapLazyInitializer li;
|
||||
|
||||
private Object replacement;
|
||||
|
||||
|
@ -58,22 +59,22 @@ public class MapProxy implements HibernateProxy, Map, Serializable {
|
|||
return li.getMap().containsValue(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override @SuppressWarnings("rawtypes")
|
||||
public Collection values() {
|
||||
return li.getMap().values();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override @SuppressWarnings("unchecked")
|
||||
public void putAll(Map t) {
|
||||
li.getMap().putAll(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override @SuppressWarnings("rawtypes")
|
||||
public Set entrySet() {
|
||||
return li.getMap().entrySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override @SuppressWarnings("rawtypes")
|
||||
public Set keySet() {
|
||||
return li.getMap().keySet();
|
||||
}
|
||||
|
@ -88,7 +89,7 @@ public class MapProxy implements HibernateProxy, Map, Serializable {
|
|||
return li.getMap().remove(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override @SuppressWarnings("unchecked")
|
||||
public Object put(Object key, Object value) {
|
||||
return li.getMap().put(key, value);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ package org.hibernate.proxy.map;
|
|||
import java.lang.reflect.Method;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.proxy.ProxyFactory;
|
||||
|
@ -24,11 +23,11 @@ public class MapProxyFactory implements ProxyFactory {
|
|||
|
||||
public void postInstantiate(
|
||||
final String entityName,
|
||||
final Class persistentClass,
|
||||
final Set interfaces,
|
||||
final Class<?> persistentClass,
|
||||
final Set<Class<?>> interfaces,
|
||||
final Method getIdentifierMethod,
|
||||
final Method setIdentifierMethod,
|
||||
CompositeType componentIdType) throws HibernateException {
|
||||
CompositeType componentIdType) {
|
||||
this.entityName = entityName;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public abstract class BasicLazyInitializer extends AbstractLazyInitializer {
|
|||
|
||||
protected static final Object INVOKE_IMPLEMENTATION = new MarkerObject( "INVOKE_IMPLEMENTATION" );
|
||||
|
||||
protected final Class persistentClass;
|
||||
protected final Class<?> persistentClass;
|
||||
protected final Method getIdentifierMethod;
|
||||
protected final Method setIdentifierMethod;
|
||||
protected final boolean overridesEquals;
|
||||
|
@ -32,7 +32,7 @@ public abstract class BasicLazyInitializer extends AbstractLazyInitializer {
|
|||
|
||||
protected BasicLazyInitializer(
|
||||
String entityName,
|
||||
Class persistentClass,
|
||||
Class<?> persistentClass,
|
||||
Object id,
|
||||
Method getIdentifierMethod,
|
||||
Method setIdentifierMethod,
|
||||
|
@ -108,7 +108,7 @@ public abstract class BasicLazyInitializer extends AbstractLazyInitializer {
|
|||
|
||||
}
|
||||
|
||||
public final Class getPersistentClass() {
|
||||
public final Class<?> getPersistentClass() {
|
||||
return persistentClass;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,6 @@ import java.util.Set;
|
|||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.mapping.Property;
|
||||
|
@ -31,16 +29,14 @@ import org.hibernate.tuple.entity.PojoEntityTuplizer;
|
|||
*/
|
||||
public final class ProxyFactoryHelper {
|
||||
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( ProxyFactoryHelper.class );
|
||||
|
||||
private ProxyFactoryHelper() {
|
||||
//not meant to be instantiated
|
||||
}
|
||||
|
||||
public static Set<Class> extractProxyInterfaces(final PersistentClass persistentClass, final String entityName) {
|
||||
final Set<Class> proxyInterfaces = new java.util.HashSet<>();
|
||||
final Class mappedClass = persistentClass.getMappedClass();
|
||||
final Class proxyInterface = persistentClass.getProxyInterface();
|
||||
public static Set<Class<?>> extractProxyInterfaces(final PersistentClass persistentClass, final String entityName) {
|
||||
final Set<Class<?>> proxyInterfaces = new java.util.HashSet<>();
|
||||
final Class<?> mappedClass = persistentClass.getMappedClass();
|
||||
final Class<?> proxyInterface = persistentClass.getProxyInterface();
|
||||
|
||||
if ( proxyInterface != null && !mappedClass.equals( proxyInterface ) ) {
|
||||
if ( !proxyInterface.isInterface() ) {
|
||||
|
@ -58,8 +54,8 @@ public final class ProxyFactoryHelper {
|
|||
Iterator<Subclass> subclasses = persistentClass.getSubclassIterator();
|
||||
while ( subclasses.hasNext() ) {
|
||||
final Subclass subclass = subclasses.next();
|
||||
final Class subclassProxy = subclass.getProxyInterface();
|
||||
final Class subclassClass = subclass.getMappedClass();
|
||||
final Class<?> subclassProxy = subclass.getProxyInterface();
|
||||
final Class<?> subclassClass = subclass.getMappedClass();
|
||||
if ( subclassProxy != null && !subclassClass.equals( subclassProxy ) ) {
|
||||
if ( !subclassProxy.isInterface() ) {
|
||||
throw new MappingException(
|
||||
|
@ -75,8 +71,8 @@ public final class ProxyFactoryHelper {
|
|||
}
|
||||
|
||||
public static void validateProxyability(final PersistentClass persistentClass) {
|
||||
Iterator properties = persistentClass.getPropertyIterator();
|
||||
Class clazz = persistentClass.getMappedClass();
|
||||
Iterator<?> properties = persistentClass.getPropertyIterator();
|
||||
Class<?> clazz = persistentClass.getMappedClass();
|
||||
while ( properties.hasNext() ) {
|
||||
Property property = (Property) properties.next();
|
||||
validateGetterSetterMethodProxyability( "Getter", property.getGetter( clazz ).getMethod() );
|
||||
|
@ -97,21 +93,19 @@ public final class ProxyFactoryHelper {
|
|||
}
|
||||
}
|
||||
|
||||
public static Method extractProxySetIdentifierMethod(final Setter idSetter, final Class proxyInterface) {
|
||||
public static Method extractProxySetIdentifierMethod(final Setter idSetter, final Class<?> proxyInterface) {
|
||||
Method idSetterMethod = idSetter == null ? null : idSetter.getMethod();
|
||||
|
||||
Method proxySetIdentifierMethod = idSetterMethod == null || proxyInterface == null ?
|
||||
null :
|
||||
ReflectHelper.getMethod( proxyInterface, idSetterMethod );
|
||||
return proxySetIdentifierMethod;
|
||||
return idSetterMethod == null || proxyInterface == null
|
||||
? null
|
||||
: ReflectHelper.getMethod( proxyInterface, idSetterMethod );
|
||||
}
|
||||
|
||||
public static Method extractProxyGetIdentifierMethod(final Getter idGetter, final Class proxyInterface) {
|
||||
public static Method extractProxyGetIdentifierMethod(final Getter idGetter, final Class<?> proxyInterface) {
|
||||
Method idGetterMethod = idGetter == null ? null : idGetter.getMethod();
|
||||
|
||||
Method proxyGetIdentifierMethod = idGetterMethod == null || proxyInterface == null ?
|
||||
null :
|
||||
ReflectHelper.getMethod( proxyInterface, idGetterMethod );
|
||||
return proxyGetIdentifierMethod;
|
||||
return idGetterMethod == null || proxyInterface == null
|
||||
? null
|
||||
: ReflectHelper.getMethod( proxyInterface, idGetterMethod );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,12 +21,12 @@ import static org.hibernate.internal.CoreLogging.messageLogger;
|
|||
public class ByteBuddyInterceptor extends BasicLazyInitializer implements ProxyConfiguration.Interceptor {
|
||||
private static final CoreMessageLogger LOG = messageLogger( ByteBuddyInterceptor.class );
|
||||
|
||||
private final Class[] interfaces;
|
||||
private final Class<?>[] interfaces;
|
||||
|
||||
public ByteBuddyInterceptor(
|
||||
String entityName,
|
||||
Class persistentClass,
|
||||
Class[] interfaces,
|
||||
Class<?> persistentClass,
|
||||
Class<?>[] interfaces,
|
||||
Object id,
|
||||
Method getIdentifierMethod,
|
||||
Method setIdentifierMethod,
|
||||
|
|
|
@ -28,15 +28,15 @@ public class ByteBuddyProxyFactory implements ProxyFactory, Serializable {
|
|||
|
||||
private final ByteBuddyProxyHelper byteBuddyProxyHelper;
|
||||
|
||||
private Class persistentClass;
|
||||
private Class<?> persistentClass;
|
||||
private String entityName;
|
||||
private Class[] interfaces;
|
||||
private Class<?>[] interfaces;
|
||||
private Method getIdentifierMethod;
|
||||
private Method setIdentifierMethod;
|
||||
private CompositeType componentIdType;
|
||||
private boolean overridesEquals;
|
||||
|
||||
private Class proxyClass;
|
||||
private Class<?> proxyClass;
|
||||
|
||||
public ByteBuddyProxyFactory(ByteBuddyProxyHelper byteBuddyProxyHelper) {
|
||||
this.byteBuddyProxyHelper = byteBuddyProxyHelper;
|
||||
|
@ -45,8 +45,8 @@ public class ByteBuddyProxyFactory implements ProxyFactory, Serializable {
|
|||
@Override
|
||||
public void postInstantiate(
|
||||
String entityName,
|
||||
Class persistentClass,
|
||||
Set<Class> interfaces,
|
||||
Class<?> persistentClass,
|
||||
Set<Class<?>> interfaces,
|
||||
Method getIdentifierMethod,
|
||||
Method setIdentifierMethod,
|
||||
CompositeType componentIdType) throws HibernateException {
|
||||
|
@ -61,7 +61,7 @@ public class ByteBuddyProxyFactory implements ProxyFactory, Serializable {
|
|||
this.proxyClass = byteBuddyProxyHelper.buildProxy( persistentClass, this.interfaces );
|
||||
}
|
||||
|
||||
private Class[] toArray(Set<Class> interfaces) {
|
||||
private Class<?>[] toArray(Set<Class<?>> interfaces) {
|
||||
if ( interfaces == null ) {
|
||||
return ArrayHelper.EMPTY_CLASS_ARRAY;
|
||||
}
|
||||
|
|
|
@ -58,12 +58,11 @@ public class ByteBuddyProxyHelper implements Serializable {
|
|||
/**
|
||||
* Do not remove: used by Quarkus
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public DynamicType.Unloaded<?> buildUnloadedProxy(final Class persistentClass, final Class[] interfaces) {
|
||||
public DynamicType.Unloaded<?> buildUnloadedProxy(final Class<?> persistentClass, final Class<?>[] interfaces) {
|
||||
return byteBuddyState.make( proxyBuilder( persistentClass, interfaces ) );
|
||||
}
|
||||
|
||||
private Function<ByteBuddy, DynamicType.Builder<?>> proxyBuilder(Class persistentClass, Class[] interfaces) {
|
||||
private Function<ByteBuddy, DynamicType.Builder<?>> proxyBuilder(Class<?> persistentClass, Class<?>[] interfaces) {
|
||||
return byteBuddy -> byteBuddy
|
||||
.ignore( byteBuddyState.getProxyDefinitionHelpers().getGroovyGetMetaClassFilter() )
|
||||
.with( new NamingStrategy.SuffixingRandom( PROXY_NAMING_SUFFIX, new NamingStrategy.SuffixingRandom.BaseNameResolver.ForFixedValue( persistentClass.getName() ) ) )
|
||||
|
@ -93,7 +92,7 @@ public class ByteBuddyProxyHelper implements Serializable {
|
|||
|
||||
// note: interface is assumed to already contain HibernateProxy.class
|
||||
try {
|
||||
final Class proxyClass = buildProxy(
|
||||
final Class<?> proxyClass = buildProxy(
|
||||
serializableProxy.getPersistentClass(),
|
||||
serializableProxy.getInterfaces()
|
||||
);
|
||||
|
|
|
@ -17,15 +17,15 @@ import org.hibernate.proxy.HibernateProxy;
|
|||
import org.hibernate.type.CompositeType;
|
||||
|
||||
public final class SerializableProxy extends AbstractSerializableProxy {
|
||||
private final Class persistentClass;
|
||||
private final Class[] interfaces;
|
||||
private final Class<?> persistentClass;
|
||||
private final Class<?>[] interfaces;
|
||||
|
||||
private final String identifierGetterMethodName;
|
||||
private final Class identifierGetterMethodClass;
|
||||
private final Class<?> identifierGetterMethodClass;
|
||||
|
||||
private final String identifierSetterMethodName;
|
||||
private final Class identifierSetterMethodClass;
|
||||
private final Class[] identifierSetterMethodParams;
|
||||
private final Class<?> identifierSetterMethodClass;
|
||||
private final Class<?>[] identifierSetterMethodParams;
|
||||
|
||||
private final CompositeType componentIdType;
|
||||
|
||||
|
@ -35,8 +35,8 @@ public final class SerializableProxy extends AbstractSerializableProxy {
|
|||
@Deprecated
|
||||
public SerializableProxy(
|
||||
String entityName,
|
||||
Class persistentClass,
|
||||
Class[] interfaces,
|
||||
Class<?> persistentClass,
|
||||
Class<?>[] interfaces,
|
||||
Serializable id,
|
||||
Boolean readOnly,
|
||||
Method getIdentifierMethod,
|
||||
|
@ -50,8 +50,8 @@ public final class SerializableProxy extends AbstractSerializableProxy {
|
|||
|
||||
public SerializableProxy(
|
||||
String entityName,
|
||||
Class persistentClass,
|
||||
Class[] interfaces,
|
||||
Class<?> persistentClass,
|
||||
Class<?>[] interfaces,
|
||||
Object id,
|
||||
Boolean readOnly,
|
||||
String sessionFactoryUuid,
|
||||
|
@ -95,35 +95,35 @@ public final class SerializableProxy extends AbstractSerializableProxy {
|
|||
return super.getId();
|
||||
}
|
||||
|
||||
protected Class getPersistentClass() {
|
||||
Class<?> getPersistentClass() {
|
||||
return persistentClass;
|
||||
}
|
||||
|
||||
protected Class[] getInterfaces() {
|
||||
Class<?>[] getInterfaces() {
|
||||
return interfaces;
|
||||
}
|
||||
|
||||
protected String getIdentifierGetterMethodName() {
|
||||
String getIdentifierGetterMethodName() {
|
||||
return identifierGetterMethodName;
|
||||
}
|
||||
|
||||
protected Class getIdentifierGetterMethodClass() {
|
||||
Class<?> getIdentifierGetterMethodClass() {
|
||||
return identifierGetterMethodClass;
|
||||
}
|
||||
|
||||
protected String getIdentifierSetterMethodName() {
|
||||
String getIdentifierSetterMethodName() {
|
||||
return identifierSetterMethodName;
|
||||
}
|
||||
|
||||
protected Class getIdentifierSetterMethodClass() {
|
||||
Class<?> getIdentifierSetterMethodClass() {
|
||||
return identifierSetterMethodClass;
|
||||
}
|
||||
|
||||
protected Class[] getIdentifierSetterMethodParams() {
|
||||
Class<?>[] getIdentifierSetterMethodParams() {
|
||||
return identifierSetterMethodParams;
|
||||
}
|
||||
|
||||
protected CompositeType getComponentIdType() {
|
||||
CompositeType getComponentIdType() {
|
||||
return componentIdType;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,6 @@ import org.hibernate.type.Type;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface Attribute {
|
||||
public String getName();
|
||||
public Type getType();
|
||||
String getName();
|
||||
Type getType();
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public class DynamicMapInstantiator implements Instantiator {
|
|||
public static final String KEY = "$type$";
|
||||
|
||||
private final String roleName;
|
||||
private Set<String> isInstanceEntityNames = new HashSet<>();
|
||||
private final Set<String> isInstanceEntityNames = new HashSet<>();
|
||||
|
||||
public DynamicMapInstantiator() {
|
||||
this.roleName = null;
|
||||
|
|
|
@ -15,7 +15,7 @@ public interface InMemoryValueGenerationStrategy {
|
|||
*
|
||||
* @return When the value is generated.
|
||||
*/
|
||||
public GenerationTiming getGenerationTiming();
|
||||
GenerationTiming getGenerationTiming();
|
||||
|
||||
/**
|
||||
* Obtain the in-VM value generator.
|
||||
|
@ -25,5 +25,5 @@ public interface InMemoryValueGenerationStrategy {
|
|||
*
|
||||
* @return The strategy for performing in-VM value generation
|
||||
*/
|
||||
public ValueGenerator getValueGenerator();
|
||||
ValueGenerator<?> getValueGenerator();
|
||||
}
|
||||
|
|
|
@ -26,9 +26,9 @@ import org.hibernate.mapping.Component;
|
|||
public class PojoInstantiator implements Instantiator, Serializable {
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( PojoInstantiator.class.getName() );
|
||||
|
||||
private transient Constructor constructor;
|
||||
private transient Constructor<?> constructor;
|
||||
|
||||
private final Class mappedClass;
|
||||
private final Class<?> mappedClass;
|
||||
private final transient ReflectionOptimizer.InstantiationOptimizer optimizer;
|
||||
private final boolean embeddedIdentifier;
|
||||
private final boolean isAbstract;
|
||||
|
@ -38,7 +38,7 @@ public class PojoInstantiator implements Instantiator, Serializable {
|
|||
*/
|
||||
@Deprecated
|
||||
public PojoInstantiator(
|
||||
Class mappedClass,
|
||||
Class<?> mappedClass,
|
||||
ReflectionOptimizer.InstantiationOptimizer optimizer,
|
||||
boolean embeddedIdentifier) {
|
||||
this.mappedClass = mappedClass;
|
||||
|
@ -67,7 +67,7 @@ public class PojoInstantiator implements Instantiator, Serializable {
|
|||
* @deprecated (as of 6.0) See {@link PojoInstantiator}
|
||||
*/
|
||||
@Deprecated
|
||||
public PojoInstantiator(Class componentClass, ReflectionOptimizer.InstantiationOptimizer optimizer) {
|
||||
public PojoInstantiator(Class<?> componentClass, ReflectionOptimizer.InstantiationOptimizer optimizer) {
|
||||
this.mappedClass = componentClass;
|
||||
this.isAbstract = ReflectHelper.isAbstractClass( mappedClass );
|
||||
this.optimizer = optimizer;
|
||||
|
|
|
@ -19,5 +19,5 @@ public interface Property extends Attribute {
|
|||
* @deprecated DOM4j entity mode is no longer supported
|
||||
*/
|
||||
@Deprecated
|
||||
public String getNode();
|
||||
String getNode();
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public interface Tuplizer {
|
|||
* @param i The index of the property for which to extract the value.
|
||||
* @return The current value of the given property on the given entity.
|
||||
*/
|
||||
public Object getPropertyValue(Object entity, int i);
|
||||
Object getPropertyValue(Object entity, int i);
|
||||
|
||||
/**
|
||||
* Return the pojo class managed by this tuplizer.
|
||||
|
@ -56,7 +56,7 @@ public interface Tuplizer {
|
|||
*
|
||||
* @return The persistent class.
|
||||
*/
|
||||
public Class getMappedClass();
|
||||
Class<?> getMappedClass();
|
||||
|
||||
/**
|
||||
* Retrieve the getter for the specified property.
|
||||
|
@ -64,5 +64,5 @@ public interface Tuplizer {
|
|||
* @param i The property index.
|
||||
* @return The property getter.
|
||||
*/
|
||||
public Getter getGetter(int i);
|
||||
Getter getGetter(int i);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public interface ValueGenerator<T> {
|
|||
*
|
||||
* @return The generated value
|
||||
*/
|
||||
public T generateValue(Session session, Object owner);
|
||||
T generateValue(Session session, Object owner);
|
||||
|
||||
/**
|
||||
* Generate the value.
|
||||
|
@ -33,7 +33,7 @@ public interface ValueGenerator<T> {
|
|||
*
|
||||
* @return The generated value
|
||||
*/
|
||||
public default T generateValue(Session session, Object owner, Object currentValue) {
|
||||
default T generateValue(Session session, Object owner, Object currentValue) {
|
||||
return generateValue(session, owner);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,158 +59,153 @@ public abstract class AbstractCompositionAttribute
|
|||
|
||||
@Override
|
||||
public Iterable<AttributeDefinition> getAttributes() {
|
||||
return new Iterable<AttributeDefinition>() {
|
||||
return () -> new Iterator<>() {
|
||||
private final int numberOfAttributes = getType().getSubtypes().length;
|
||||
private int currentSubAttributeNumber;
|
||||
private int currentColumnPosition = columnStartPosition;
|
||||
|
||||
@Override
|
||||
public Iterator<AttributeDefinition> iterator() {
|
||||
return new Iterator<AttributeDefinition>() {
|
||||
private final int numberOfAttributes = getType().getSubtypes().length;
|
||||
private int currentSubAttributeNumber;
|
||||
private int currentColumnPosition = columnStartPosition;
|
||||
public boolean hasNext() {
|
||||
return currentSubAttributeNumber < numberOfAttributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return currentSubAttributeNumber < numberOfAttributes;
|
||||
@Override
|
||||
public AttributeDefinition next() {
|
||||
final int subAttributeNumber = currentSubAttributeNumber;
|
||||
currentSubAttributeNumber++;
|
||||
|
||||
final String name = getType().getPropertyNames()[subAttributeNumber];
|
||||
final Type type = getType().getSubtypes()[subAttributeNumber];
|
||||
|
||||
int columnPosition = currentColumnPosition;
|
||||
currentColumnPosition += type.getColumnSpan( sessionFactory() );
|
||||
|
||||
final CompositeType cType = getType();
|
||||
final boolean nullable =
|
||||
cType.getPropertyNullability() == null ||
|
||||
cType.getPropertyNullability()[subAttributeNumber];
|
||||
|
||||
if ( type.isAssociationType() ) {
|
||||
// we build the association-key here because of the "goofiness" with 'currentColumnPosition'
|
||||
final AssociationKey associationKey;
|
||||
final AssociationType aType = (AssociationType) type;
|
||||
|
||||
if ( aType.isAnyType() ) {
|
||||
associationKey = new AssociationKey(
|
||||
JoinHelper.getLHSTableName(
|
||||
aType,
|
||||
attributeNumber(),
|
||||
(OuterJoinLoadable) locateOwningPersister()
|
||||
),
|
||||
JoinHelper.getLHSColumnNames(
|
||||
aType,
|
||||
attributeNumber(),
|
||||
columnPosition,
|
||||
(OuterJoinLoadable) locateOwningPersister(),
|
||||
sessionFactory()
|
||||
)
|
||||
);
|
||||
}
|
||||
else if ( aType.getForeignKeyDirection() == ForeignKeyDirection.FROM_PARENT ) {
|
||||
final Joinable joinable = aType.getAssociatedJoinable( sessionFactory() );
|
||||
|
||||
@Override
|
||||
public AttributeDefinition next() {
|
||||
final int subAttributeNumber = currentSubAttributeNumber;
|
||||
currentSubAttributeNumber++;
|
||||
final String lhsTableName;
|
||||
final String[] lhsColumnNames;
|
||||
|
||||
final String name = getType().getPropertyNames()[subAttributeNumber];
|
||||
final Type type = getType().getSubtypes()[subAttributeNumber];
|
||||
|
||||
int columnPosition = currentColumnPosition;
|
||||
currentColumnPosition += type.getColumnSpan( sessionFactory() );
|
||||
|
||||
final CompositeType cType = getType();
|
||||
final boolean nullable =
|
||||
cType.getPropertyNullability() == null ||
|
||||
cType.getPropertyNullability()[subAttributeNumber];
|
||||
|
||||
if ( type.isAssociationType() ) {
|
||||
// we build the association-key here because of the "goofiness" with 'currentColumnPosition'
|
||||
final AssociationKey associationKey;
|
||||
final AssociationType aType = (AssociationType) type;
|
||||
|
||||
if ( aType.isAnyType() ) {
|
||||
associationKey = new AssociationKey(
|
||||
JoinHelper.getLHSTableName(
|
||||
aType,
|
||||
attributeNumber(),
|
||||
(OuterJoinLoadable) locateOwningPersister()
|
||||
),
|
||||
JoinHelper.getLHSColumnNames(
|
||||
aType,
|
||||
attributeNumber(),
|
||||
columnPosition,
|
||||
(OuterJoinLoadable) locateOwningPersister(),
|
||||
sessionFactory()
|
||||
)
|
||||
);
|
||||
}
|
||||
else if ( aType.getForeignKeyDirection() == ForeignKeyDirection.FROM_PARENT ) {
|
||||
final Joinable joinable = aType.getAssociatedJoinable( sessionFactory() );
|
||||
|
||||
final String lhsTableName;
|
||||
final String[] lhsColumnNames;
|
||||
|
||||
if ( joinable.isCollection() ) {
|
||||
final QueryableCollection collectionPersister = (QueryableCollection) joinable;
|
||||
lhsTableName = collectionPersister.getTableName();
|
||||
lhsColumnNames = collectionPersister.getElementColumnNames();
|
||||
}
|
||||
else {
|
||||
final OuterJoinLoadable entityPersister = (OuterJoinLoadable) locateOwningPersister();
|
||||
lhsTableName = getLHSTableName( aType, attributeNumber(), entityPersister );
|
||||
lhsColumnNames = getLHSColumnNames(
|
||||
aType,
|
||||
attributeNumber(),
|
||||
columnPosition,
|
||||
entityPersister,
|
||||
sessionFactory()
|
||||
);
|
||||
}
|
||||
associationKey = new AssociationKey( lhsTableName, lhsColumnNames );
|
||||
}
|
||||
else {
|
||||
final Joinable joinable = aType.getAssociatedJoinable( sessionFactory() );
|
||||
|
||||
associationKey = new AssociationKey(
|
||||
joinable.getTableName(),
|
||||
getRHSColumnNames( aType, sessionFactory() )
|
||||
);
|
||||
}
|
||||
|
||||
return new CompositeBasedAssociationAttribute(
|
||||
AbstractCompositionAttribute.this,
|
||||
sessionFactory(),
|
||||
attributeNumber(),
|
||||
name,
|
||||
(AssociationType) type,
|
||||
new BaselineAttributeInformation.Builder()
|
||||
.setInsertable( AbstractCompositionAttribute.this.isInsertable() )
|
||||
.setUpdateable( AbstractCompositionAttribute.this.isUpdateable() )
|
||||
// todo : handle nested ValueGeneration strategies...
|
||||
// disallow if our strategy != NEVER
|
||||
.setNullable( nullable )
|
||||
.setDirtyCheckable( true )
|
||||
.setVersionable( AbstractCompositionAttribute.this.isVersionable() )
|
||||
.setCascadeStyle( getType().getCascadeStyle( subAttributeNumber ) )
|
||||
.setFetchMode( getType().getFetchMode( subAttributeNumber ) )
|
||||
.createInformation(),
|
||||
subAttributeNumber,
|
||||
associationKey
|
||||
);
|
||||
}
|
||||
else if ( type.isComponentType() ) {
|
||||
return new CompositionBasedCompositionAttribute(
|
||||
AbstractCompositionAttribute.this,
|
||||
sessionFactory(),
|
||||
attributeNumber(),
|
||||
name,
|
||||
(CompositeType) type,
|
||||
columnPosition,
|
||||
new BaselineAttributeInformation.Builder()
|
||||
.setInsertable( AbstractCompositionAttribute.this.isInsertable() )
|
||||
.setUpdateable( AbstractCompositionAttribute.this.isUpdateable() )
|
||||
// todo : handle nested ValueGeneration strategies...
|
||||
// disallow if our strategy != NEVER
|
||||
.setNullable( nullable )
|
||||
.setDirtyCheckable( true )
|
||||
.setVersionable( AbstractCompositionAttribute.this.isVersionable() )
|
||||
.setCascadeStyle( getType().getCascadeStyle( subAttributeNumber ) )
|
||||
.setFetchMode( getType().getFetchMode( subAttributeNumber ) )
|
||||
.createInformation()
|
||||
);
|
||||
if ( joinable.isCollection() ) {
|
||||
final QueryableCollection collectionPersister = (QueryableCollection) joinable;
|
||||
lhsTableName = collectionPersister.getTableName();
|
||||
lhsColumnNames = collectionPersister.getElementColumnNames();
|
||||
}
|
||||
else {
|
||||
return new CompositeBasedBasicAttribute(
|
||||
AbstractCompositionAttribute.this,
|
||||
sessionFactory(),
|
||||
subAttributeNumber,
|
||||
name,
|
||||
type,
|
||||
new BaselineAttributeInformation.Builder()
|
||||
.setInsertable( AbstractCompositionAttribute.this.isInsertable() )
|
||||
.setUpdateable( AbstractCompositionAttribute.this.isUpdateable() )
|
||||
// todo : handle nested ValueGeneration strategies...
|
||||
// disallow if our strategy != NEVER
|
||||
.setNullable( nullable )
|
||||
.setDirtyCheckable( true )
|
||||
.setVersionable( AbstractCompositionAttribute.this.isVersionable() )
|
||||
.setCascadeStyle( getType().getCascadeStyle( subAttributeNumber ) )
|
||||
.setFetchMode( getType().getFetchMode( subAttributeNumber ) )
|
||||
.createInformation()
|
||||
final OuterJoinLoadable entityPersister = (OuterJoinLoadable) locateOwningPersister();
|
||||
lhsTableName = getLHSTableName( aType, attributeNumber(), entityPersister );
|
||||
lhsColumnNames = getLHSColumnNames(
|
||||
aType,
|
||||
attributeNumber(),
|
||||
columnPosition,
|
||||
entityPersister,
|
||||
sessionFactory()
|
||||
);
|
||||
}
|
||||
associationKey = new AssociationKey( lhsTableName, lhsColumnNames );
|
||||
}
|
||||
else {
|
||||
final Joinable joinable = aType.getAssociatedJoinable( sessionFactory() );
|
||||
|
||||
associationKey = new AssociationKey(
|
||||
joinable.getTableName(),
|
||||
getRHSColumnNames( aType, sessionFactory() )
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException( "Remove operation not supported here" );
|
||||
}
|
||||
};
|
||||
return new CompositeBasedAssociationAttribute(
|
||||
AbstractCompositionAttribute.this,
|
||||
sessionFactory(),
|
||||
attributeNumber(),
|
||||
name,
|
||||
(AssociationType) type,
|
||||
new BaselineAttributeInformation.Builder()
|
||||
.setInsertable( AbstractCompositionAttribute.this.isInsertable() )
|
||||
.setUpdateable( AbstractCompositionAttribute.this.isUpdateable() )
|
||||
// todo : handle nested ValueGeneration strategies...
|
||||
// disallow if our strategy != NEVER
|
||||
.setNullable( nullable )
|
||||
.setDirtyCheckable( true )
|
||||
.setVersionable( AbstractCompositionAttribute.this.isVersionable() )
|
||||
.setCascadeStyle( getType().getCascadeStyle( subAttributeNumber ) )
|
||||
.setFetchMode( getType().getFetchMode( subAttributeNumber ) )
|
||||
.createInformation(),
|
||||
subAttributeNumber,
|
||||
associationKey
|
||||
);
|
||||
}
|
||||
else if ( type.isComponentType() ) {
|
||||
return new CompositionBasedCompositionAttribute(
|
||||
AbstractCompositionAttribute.this,
|
||||
sessionFactory(),
|
||||
attributeNumber(),
|
||||
name,
|
||||
(CompositeType) type,
|
||||
columnPosition,
|
||||
new BaselineAttributeInformation.Builder()
|
||||
.setInsertable( AbstractCompositionAttribute.this.isInsertable() )
|
||||
.setUpdateable( AbstractCompositionAttribute.this.isUpdateable() )
|
||||
// todo : handle nested ValueGeneration strategies...
|
||||
// disallow if our strategy != NEVER
|
||||
.setNullable( nullable )
|
||||
.setDirtyCheckable( true )
|
||||
.setVersionable( AbstractCompositionAttribute.this.isVersionable() )
|
||||
.setCascadeStyle( getType().getCascadeStyle( subAttributeNumber ) )
|
||||
.setFetchMode( getType().getFetchMode( subAttributeNumber ) )
|
||||
.createInformation()
|
||||
);
|
||||
}
|
||||
else {
|
||||
return new CompositeBasedBasicAttribute(
|
||||
AbstractCompositionAttribute.this,
|
||||
sessionFactory(),
|
||||
subAttributeNumber,
|
||||
name,
|
||||
type,
|
||||
new BaselineAttributeInformation.Builder()
|
||||
.setInsertable( AbstractCompositionAttribute.this.isInsertable() )
|
||||
.setUpdateable( AbstractCompositionAttribute.this.isUpdateable() )
|
||||
// todo : handle nested ValueGeneration strategies...
|
||||
// disallow if our strategy != NEVER
|
||||
.setNullable( nullable )
|
||||
.setDirtyCheckable( true )
|
||||
.setVersionable( AbstractCompositionAttribute.this.isVersionable() )
|
||||
.setCascadeStyle( getType().getCascadeStyle( subAttributeNumber ) )
|
||||
.setFetchMode( getType().getFetchMode( subAttributeNumber ) )
|
||||
.createInformation()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException( "Remove operation not supported here" );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -39,11 +39,11 @@ public class CompositionBasedCompositionAttribute extends AbstractCompositionAtt
|
|||
@Override
|
||||
protected EntityPersister locateOwningPersister() {
|
||||
final AbstractCompositionAttribute source = (AbstractCompositionAttribute) getSource();
|
||||
if ( EntityDefinition.class.isInstance( source.getSource() ) ) {
|
||||
return EntityDefinition.class.cast( source.getSource() ).getEntityPersister();
|
||||
if (source.getSource() instanceof EntityDefinition) {
|
||||
return ( (EntityDefinition) source.getSource() ).getEntityPersister();
|
||||
}
|
||||
else {
|
||||
return AbstractCompositionAttribute.class.cast( source.getSource() ).locateOwningPersister();
|
||||
return ( (AbstractCompositionAttribute) source.getSource() ).locateOwningPersister();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public final class BytecodeEnhancementMetadataPojoImpl implements BytecodeEnhanc
|
|||
CompositeType nonAggregatedCidMapper,
|
||||
boolean collectionsInDefaultFetchGroupEnabled,
|
||||
PersisterCreationContext creationContext) {
|
||||
final Class mappedClass = persistentClass.getMappedClass();
|
||||
final Class<?> mappedClass = persistentClass.getMappedClass();
|
||||
final boolean enhancedForLazyLoading = PersistentAttributeInterceptable.class.isAssignableFrom( mappedClass );
|
||||
final LazyAttributesMetadata lazyAttributesMetadata = enhancedForLazyLoading
|
||||
? LazyAttributesMetadata.from( persistentClass, true, collectionsInDefaultFetchGroupEnabled, creationContext )
|
||||
|
@ -57,16 +57,15 @@ public final class BytecodeEnhancementMetadataPojoImpl implements BytecodeEnhanc
|
|||
}
|
||||
|
||||
private final String entityName;
|
||||
private final Class entityClass;
|
||||
private final Class<?> entityClass;
|
||||
private final Set<String> identifierAttributeNames;
|
||||
private final CompositeType nonAggregatedCidMapper;
|
||||
private final boolean enhancedForLazyLoading;
|
||||
private final LazyAttributesMetadata lazyAttributesMetadata;
|
||||
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
protected BytecodeEnhancementMetadataPojoImpl(
|
||||
BytecodeEnhancementMetadataPojoImpl(
|
||||
String entityName,
|
||||
Class entityClass,
|
||||
Class<?> entityClass,
|
||||
Set<String> identifierAttributeNames,
|
||||
CompositeType nonAggregatedCidMapper,
|
||||
boolean enhancedForLazyLoading,
|
||||
|
@ -105,7 +104,7 @@ public final class BytecodeEnhancementMetadataPojoImpl implements BytecodeEnhanc
|
|||
|
||||
final BytecodeLazyAttributeInterceptor interceptor = extractLazyInterceptor( entity );
|
||||
if ( interceptor instanceof LazyAttributeLoadingInterceptor ) {
|
||||
return ( (LazyAttributeLoadingInterceptor) interceptor ).hasAnyUninitializedAttributes();
|
||||
return interceptor.hasAnyUninitializedAttributes();
|
||||
}
|
||||
|
||||
//noinspection RedundantIfStatement
|
||||
|
@ -124,7 +123,7 @@ public final class BytecodeEnhancementMetadataPojoImpl implements BytecodeEnhanc
|
|||
|
||||
final BytecodeLazyAttributeInterceptor interceptor = extractLazyInterceptor( entity );
|
||||
if ( interceptor instanceof LazyAttributeLoadingInterceptor ) {
|
||||
return ( (LazyAttributeLoadingInterceptor) interceptor ).isAttributeLoaded( attributeName );
|
||||
return interceptor.isAttributeLoaded( attributeName );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -78,7 +78,7 @@ public class DynamicMapEntityTuplizer extends AbstractEntityTuplizer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class getMappedClass() {
|
||||
public Class<?> getMappedClass() {
|
||||
return Map.class;
|
||||
}
|
||||
|
||||
|
@ -89,10 +89,10 @@ public class DynamicMapEntityTuplizer extends AbstractEntityTuplizer {
|
|||
|
||||
@Override
|
||||
public String determineConcreteSubclassEntityName(Object entityInstance, SessionFactoryImplementor factory) {
|
||||
return extractEmbeddedEntityName( (Map) entityInstance );
|
||||
return extractEmbeddedEntityName( (Map<?,?>) entityInstance );
|
||||
}
|
||||
|
||||
public static String extractEmbeddedEntityName(Map entity) {
|
||||
public static String extractEmbeddedEntityName(Map<?,?> entity) {
|
||||
return (String) entity.get( DynamicMapInstantiator.KEY );
|
||||
}
|
||||
|
||||
|
@ -101,10 +101,10 @@ public class DynamicMapEntityTuplizer extends AbstractEntityTuplizer {
|
|||
|
||||
@Override
|
||||
public String resolveEntityName(Object entity) {
|
||||
if ( !Map.class.isInstance( entity ) ) {
|
||||
if ( !(entity instanceof Map) ) {
|
||||
return null;
|
||||
}
|
||||
final String entityName = extractEmbeddedEntityName( (Map) entity );
|
||||
final String entityName = extractEmbeddedEntityName( (Map<?,?>) entity );
|
||||
if ( entityName == null ) {
|
||||
throw new HibernateException( "Could not determine type of dynamic map entity" );
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ public class EntityMetamodel implements Serializable {
|
|||
private final boolean inherited;
|
||||
private final boolean hasSubclasses;
|
||||
private final Set<String> subclassEntityNames;
|
||||
private final Map<Class,String> entityNameByInheritenceClassMap;
|
||||
private final Map<Class<?>,String> entityNameByInheritenceClassMap;
|
||||
|
||||
private final BytecodeEnhancementMetadata bytecodeEnhancementMetadata;
|
||||
|
||||
|
@ -290,7 +290,7 @@ public class EntityMetamodel implements Serializable {
|
|||
if ( pair.getInMemoryStrategy() != null ) {
|
||||
final GenerationTiming timing = pair.getInMemoryStrategy().getGenerationTiming();
|
||||
if ( timing != GenerationTiming.NEVER ) {
|
||||
final ValueGenerator generator = pair.getInMemoryStrategy().getValueGenerator();
|
||||
final ValueGenerator<?> generator = pair.getInMemoryStrategy().getValueGenerator();
|
||||
if ( generator != null ) {
|
||||
// we have some level of generation indicated
|
||||
if ( timing == GenerationTiming.INSERT ) {
|
||||
|
@ -372,7 +372,7 @@ public class EntityMetamodel implements Serializable {
|
|||
ReflectHelper.isAbstractClass( persistentClass.getMappedClass() );
|
||||
}
|
||||
else {
|
||||
isAbstract = persistentClass.isAbstract().booleanValue();
|
||||
isAbstract = persistentClass.isAbstract();
|
||||
if ( !isAbstract && persistentClass.hasPojoRepresentation() &&
|
||||
ReflectHelper.isAbstractClass( persistentClass.getMappedClass() ) ) {
|
||||
LOG.entityMappedAsNonAbstract(name);
|
||||
|
@ -405,7 +405,7 @@ public class EntityMetamodel implements Serializable {
|
|||
hasCollections = foundCollection;
|
||||
mutablePropertiesIndexes = mutableIndexes;
|
||||
|
||||
Iterator iter = persistentClass.getSubclassIterator();
|
||||
Iterator<?> iter = persistentClass.getSubclassIterator();
|
||||
final Set<String> subclassEntityNamesLocal = new HashSet<>();
|
||||
while ( iter.hasNext() ) {
|
||||
subclassEntityNamesLocal.add( ( (PersistentClass) iter.next() ).getEntityName() );
|
||||
|
@ -413,16 +413,16 @@ public class EntityMetamodel implements Serializable {
|
|||
subclassEntityNamesLocal.add( name );
|
||||
subclassEntityNames = CollectionHelper.toSmallSet( subclassEntityNamesLocal );
|
||||
|
||||
HashMap<Class, String> entityNameByInheritenceClassMapLocal = new HashMap<Class, String>();
|
||||
HashMap<Class<?>, String> entityNameByInheritanceClassMapLocal = new HashMap<>();
|
||||
if ( persistentClass.hasPojoRepresentation() ) {
|
||||
entityNameByInheritenceClassMapLocal.put( persistentClass.getMappedClass(), persistentClass.getEntityName() );
|
||||
entityNameByInheritanceClassMapLocal.put( persistentClass.getMappedClass(), persistentClass.getEntityName() );
|
||||
iter = persistentClass.getSubclassIterator();
|
||||
while ( iter.hasNext() ) {
|
||||
final PersistentClass pc = ( PersistentClass ) iter.next();
|
||||
entityNameByInheritenceClassMapLocal.put( pc.getMappedClass(), pc.getEntityName() );
|
||||
entityNameByInheritanceClassMapLocal.put( pc.getMappedClass(), pc.getEntityName() );
|
||||
}
|
||||
}
|
||||
entityNameByInheritenceClassMap = CollectionHelper.toSmallMap( entityNameByInheritenceClassMapLocal );
|
||||
entityNameByInheritenceClassMap = CollectionHelper.toSmallMap( entityNameByInheritanceClassMapLocal );
|
||||
}
|
||||
|
||||
private static GenerationStrategyPair buildGenerationStrategyPair(
|
||||
|
@ -463,7 +463,7 @@ public class EntityMetamodel implements Serializable {
|
|||
SessionFactoryImplementor sessionFactory,
|
||||
Component composite,
|
||||
CompositeGenerationStrategyPairBuilder builder) {
|
||||
Iterator subProperties = composite.getPropertyIterator();
|
||||
Iterator<?> subProperties = composite.getPropertyIterator();
|
||||
while ( subProperties.hasNext() ) {
|
||||
final Property subProperty = (Property) subProperties.next();
|
||||
builder.addPair( buildGenerationStrategyPair( sessionFactory, subProperty ) );
|
||||
|
@ -616,7 +616,7 @@ public class EntityMetamodel implements Serializable {
|
|||
// start building the aggregate values
|
||||
int propertyIndex = -1;
|
||||
int columnIndex = 0;
|
||||
Iterator subProperties = composite.getPropertyIterator();
|
||||
Iterator<?> subProperties = composite.getPropertyIterator();
|
||||
while ( subProperties.hasNext() ) {
|
||||
propertyIndex++;
|
||||
final Property subProperty = (Property) subProperties.next();
|
||||
|
@ -672,16 +672,16 @@ public class EntityMetamodel implements Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValueGenerator getValueGenerator() {
|
||||
public ValueGenerator<?> getValueGenerator() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static class FullInMemoryValueGenerationStrategy implements InMemoryValueGenerationStrategy {
|
||||
private final GenerationTiming timing;
|
||||
private final ValueGenerator generator;
|
||||
private final ValueGenerator<?> generator;
|
||||
|
||||
private FullInMemoryValueGenerationStrategy(GenerationTiming timing, ValueGenerator generator) {
|
||||
private FullInMemoryValueGenerationStrategy(GenerationTiming timing, ValueGenerator<?> generator) {
|
||||
this.timing = timing;
|
||||
this.generator = generator;
|
||||
}
|
||||
|
@ -699,7 +699,7 @@ public class EntityMetamodel implements Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValueGenerator getValueGenerator() {
|
||||
public ValueGenerator<?> getValueGenerator() {
|
||||
return generator;
|
||||
}
|
||||
}
|
||||
|
@ -760,7 +760,7 @@ public class EntityMetamodel implements Serializable {
|
|||
private void mapPropertyToIndex(Property prop, int i) {
|
||||
propertyIndexes.put( prop.getName(), i );
|
||||
if ( prop.getValue() instanceof Component ) {
|
||||
Iterator iter = ( (Component) prop.getValue() ).getPropertyIterator();
|
||||
Iterator<?> iter = ( (Component) prop.getValue() ).getPropertyIterator();
|
||||
while ( iter.hasNext() ) {
|
||||
Property subprop = (Property) iter.next();
|
||||
propertyIndexes.put(
|
||||
|
@ -962,11 +962,11 @@ public class EntityMetamodel implements Serializable {
|
|||
/**
|
||||
* Return the entity-name mapped to the given class within our inheritance hierarchy, if any.
|
||||
*
|
||||
* @param inheritenceClass The class for which to resolve the entity-name.
|
||||
* @param inheritanceClass The class for which to resolve the entity-name.
|
||||
* @return The mapped entity-name, or null if no such mapping was found.
|
||||
*/
|
||||
public String findEntityNameByEntityClass(Class inheritenceClass) {
|
||||
return entityNameByInheritenceClassMap.get( inheritenceClass );
|
||||
public String findEntityNameByEntityClass(Class<?> inheritanceClass) {
|
||||
return entityNameByInheritenceClassMap.get( inheritanceClass );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,9 +22,9 @@ import org.hibernate.metamodel.RepresentationMode;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class EntityTuplizerFactory implements Serializable {
|
||||
public static final Class[] ENTITY_TUP_CTOR_SIG = new Class[] { EntityMetamodel.class, PersistentClass.class };
|
||||
public static final Class<?>[] ENTITY_TUP_CTOR_SIG = new Class[] { EntityMetamodel.class, PersistentClass.class };
|
||||
|
||||
private Map<RepresentationMode,Class<? extends EntityTuplizer>> defaultImplClassByMode = buildBaseMapping();
|
||||
private final Map<RepresentationMode,Class<? extends EntityTuplizer>> defaultImplClassByMode = buildBaseMapping();
|
||||
|
||||
/**
|
||||
* Method allowing registration of the tuplizer class to use as default for a particular entity-mode.
|
||||
|
@ -53,7 +53,7 @@ public class EntityTuplizerFactory implements Serializable {
|
|||
* @throws HibernateException If class name cannot be resolved to a class reference, or if the
|
||||
* {@link Constructor#newInstance} call fails.
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
@SuppressWarnings("unchecked")
|
||||
public EntityTuplizer constructTuplizer(
|
||||
String tuplizerClassName,
|
||||
EntityMetamodel metamodel,
|
||||
|
@ -92,18 +92,18 @@ public class EntityTuplizerFactory implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isEntityTuplizerImplementor(Class tuplizerClass) {
|
||||
private boolean isEntityTuplizerImplementor(Class<?> tuplizerClass) {
|
||||
return ReflectHelper.implementsInterface( tuplizerClass, EntityTuplizer.class );
|
||||
}
|
||||
|
||||
private boolean hasProperConstructor(Class<? extends EntityTuplizer> tuplizerClass, Class[] constructorArgs) {
|
||||
private boolean hasProperConstructor(Class<? extends EntityTuplizer> tuplizerClass, Class<?>[] constructorArgs) {
|
||||
return getProperConstructor( tuplizerClass, constructorArgs ) != null
|
||||
&& ! ReflectHelper.isAbstractClass( tuplizerClass );
|
||||
}
|
||||
|
||||
private Constructor<? extends EntityTuplizer> getProperConstructor(
|
||||
Class<? extends EntityTuplizer> clazz,
|
||||
Class[] constructorArgs) {
|
||||
Class<?>[] constructorArgs) {
|
||||
Constructor<? extends EntityTuplizer> constructor = null;
|
||||
try {
|
||||
constructor = clazz.getDeclaredConstructor( constructorArgs );
|
||||
|
|
|
@ -16,7 +16,6 @@ import org.hibernate.bytecode.spi.BytecodeProvider;
|
|||
import org.hibernate.bytecode.spi.ProxyFactoryFactory;
|
||||
import org.hibernate.bytecode.spi.ReflectionOptimizer;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.classic.Lifecycle;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
|
@ -27,7 +26,6 @@ import org.hibernate.property.access.spi.Getter;
|
|||
import org.hibernate.property.access.spi.Setter;
|
||||
import org.hibernate.proxy.ProxyFactory;
|
||||
import org.hibernate.proxy.pojo.ProxyFactoryHelper;
|
||||
import org.hibernate.tuple.Instantiator;
|
||||
import org.hibernate.type.CompositeType;
|
||||
|
||||
/**
|
||||
|
@ -39,20 +37,18 @@ import org.hibernate.type.CompositeType;
|
|||
public class PojoEntityTuplizer extends AbstractEntityTuplizer {
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( PojoEntityTuplizer.class );
|
||||
|
||||
private final Class mappedClass;
|
||||
private final Class proxyInterface;
|
||||
private final boolean lifecycleImplementor;
|
||||
private final Class<?> mappedClass;
|
||||
private final Class<?> proxyInterface;
|
||||
private final ReflectionOptimizer optimizer;
|
||||
|
||||
public PojoEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity) {
|
||||
super( entityMetamodel, mappedEntity );
|
||||
this.mappedClass = mappedEntity.getMappedClass();
|
||||
this.proxyInterface = mappedEntity.getProxyInterface();
|
||||
this.lifecycleImplementor = Lifecycle.class.isAssignableFrom( mappedClass );
|
||||
|
||||
String[] getterNames = new String[propertySpan];
|
||||
String[] setterNames = new String[propertySpan];
|
||||
Class[] propTypes = new Class[propertySpan];
|
||||
Class<?>[] propTypes = new Class[propertySpan];
|
||||
for ( int i = 0; i < propertySpan; i++ ) {
|
||||
getterNames[i] = getters[i].getMethodName();
|
||||
setterNames[i] = setters[i].getMethodName();
|
||||
|
@ -78,10 +74,10 @@ public class PojoEntityTuplizer extends AbstractEntityTuplizer {
|
|||
// determine the id getter and setter methods from the proxy interface (if any)
|
||||
// determine all interfaces needed by the resulting proxy
|
||||
final String entityName = getEntityName();
|
||||
final Class mappedClass = persistentClass.getMappedClass();
|
||||
final Class proxyInterface = persistentClass.getProxyInterface();
|
||||
final Class<?> mappedClass = persistentClass.getMappedClass();
|
||||
final Class<?> proxyInterface = persistentClass.getProxyInterface();
|
||||
|
||||
final Set<Class> proxyInterfaces = ProxyFactoryHelper.extractProxyInterfaces( persistentClass, entityName );
|
||||
final Set<Class<?>> proxyInterfaces = ProxyFactoryHelper.extractProxyInterfaces( persistentClass, entityName );
|
||||
|
||||
Method proxyGetIdentifierMethod = ProxyFactoryHelper.extractProxyGetIdentifierMethod( idGetter, proxyInterface );
|
||||
Method proxySetIdentifierMethod = ProxyFactoryHelper.extractProxySetIdentifierMethod( idSetter, proxyInterface );
|
||||
|
@ -135,7 +131,7 @@ public class PojoEntityTuplizer extends AbstractEntityTuplizer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class getMappedClass() {
|
||||
public Class<?> getMappedClass() {
|
||||
return mappedClass;
|
||||
}
|
||||
|
||||
|
@ -157,7 +153,7 @@ public class PojoEntityTuplizer extends AbstractEntityTuplizer {
|
|||
return getEntityName();
|
||||
}
|
||||
|
||||
final Class concreteEntityClass = entityInstance.getClass();
|
||||
final Class<?> concreteEntityClass = entityInstance.getClass();
|
||||
if ( concreteEntityClass == getMappedClass() ) {
|
||||
return getEntityName();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue