HHH-18551 Fix memory leak caused by creation of new BasicTypeImpl
This commit is contained in:
parent
cc72efd0fe
commit
b179881847
|
@ -44,7 +44,6 @@ import org.hibernate.jpa.spi.JpaCompliance;
|
||||||
import org.hibernate.metamodel.model.domain.DomainType;
|
import org.hibernate.metamodel.model.domain.DomainType;
|
||||||
import org.hibernate.metamodel.model.domain.JpaMetamodel;
|
import org.hibernate.metamodel.model.domain.JpaMetamodel;
|
||||||
import org.hibernate.metamodel.model.domain.SingularPersistentAttribute;
|
import org.hibernate.metamodel.model.domain.SingularPersistentAttribute;
|
||||||
import org.hibernate.metamodel.model.domain.internal.BasicTypeImpl;
|
|
||||||
import org.hibernate.metamodel.spi.MappingMetamodelImplementor;
|
import org.hibernate.metamodel.spi.MappingMetamodelImplementor;
|
||||||
import org.hibernate.query.BindableType;
|
import org.hibernate.query.BindableType;
|
||||||
import org.hibernate.query.ImmutableEntityUpdateQueryHandlingMode;
|
import org.hibernate.query.ImmutableEntityUpdateQueryHandlingMode;
|
||||||
|
@ -1540,7 +1539,7 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, Serializable {
|
||||||
final EnumJavaType javaType = new EnumJavaType<>( type );
|
final EnumJavaType javaType = new EnumJavaType<>( type );
|
||||||
final JdbcType jdbcType =
|
final JdbcType jdbcType =
|
||||||
javaType.getRecommendedJdbcType( typeConfiguration.getCurrentBaseSqlTypeIndicators() );
|
javaType.getRecommendedJdbcType( typeConfiguration.getCurrentBaseSqlTypeIndicators() );
|
||||||
return new BasicTypeImpl<>( javaType, jdbcType );
|
return typeConfiguration.getBasicTypeRegistry().resolve( javaType, jdbcType );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -16,7 +16,6 @@ import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.metamodel.mapping.MappingType;
|
import org.hibernate.metamodel.mapping.MappingType;
|
||||||
import org.hibernate.metamodel.mapping.SqlExpressible;
|
import org.hibernate.metamodel.mapping.SqlExpressible;
|
||||||
import org.hibernate.metamodel.model.domain.internal.BasicTypeImpl;
|
|
||||||
import org.hibernate.query.BindableType;
|
import org.hibernate.query.BindableType;
|
||||||
import org.hibernate.sql.ast.SqlAstWalker;
|
import org.hibernate.sql.ast.SqlAstWalker;
|
||||||
import org.hibernate.sql.ast.tree.expression.JdbcParameter;
|
import org.hibernate.sql.ast.tree.expression.JdbcParameter;
|
||||||
|
@ -25,6 +24,7 @@ import org.hibernate.sql.exec.spi.ExecutionContext;
|
||||||
import org.hibernate.sql.exec.spi.JdbcParameterBinder;
|
import org.hibernate.sql.exec.spi.JdbcParameterBinder;
|
||||||
import org.hibernate.sql.exec.spi.JdbcParameterBinding;
|
import org.hibernate.sql.exec.spi.JdbcParameterBinding;
|
||||||
import org.hibernate.sql.exec.spi.JdbcParameterBindings;
|
import org.hibernate.sql.exec.spi.JdbcParameterBindings;
|
||||||
|
import org.hibernate.type.BasicType;
|
||||||
import org.hibernate.type.descriptor.java.EnumJavaType;
|
import org.hibernate.type.descriptor.java.EnumJavaType;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
||||||
|
@ -133,7 +133,7 @@ public abstract class AbstractJdbcParameter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <E extends Enum<E>> BasicTypeImpl<E> createEnumType(ExecutionContext executionContext, Class<E> enumClass) {
|
private static <E extends Enum<E>> BasicType<E> createEnumType(ExecutionContext executionContext, Class<E> enumClass) {
|
||||||
final EnumJavaType<E> enumJavaType = new EnumJavaType<>( enumClass );
|
final EnumJavaType<E> enumJavaType = new EnumJavaType<>( enumClass );
|
||||||
final JdbcTypeIndicators indicators =
|
final JdbcTypeIndicators indicators =
|
||||||
executionContext.getSession().getTypeConfiguration().getCurrentBaseSqlTypeIndicators();
|
executionContext.getSession().getTypeConfiguration().getCurrentBaseSqlTypeIndicators();
|
||||||
|
@ -142,7 +142,7 @@ public abstract class AbstractJdbcParameter
|
||||||
// so just accept the default from the TypeConfiguration, which
|
// so just accept the default from the TypeConfiguration, which
|
||||||
// is usually ORDINAL (the default according to JPA)
|
// is usually ORDINAL (the default according to JPA)
|
||||||
enumJavaType.getRecommendedJdbcType(indicators);
|
enumJavaType.getRecommendedJdbcType(indicators);
|
||||||
return new BasicTypeImpl<>( enumJavaType, jdbcType );
|
return indicators.getTypeConfiguration().getBasicTypeRegistry().resolve( enumJavaType, jdbcType );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -18,7 +18,6 @@ import org.hibernate.type.descriptor.converter.spi.BasicValueConverter;
|
||||||
import org.hibernate.type.descriptor.java.spi.UnknownBasicJavaType;
|
import org.hibernate.type.descriptor.java.spi.UnknownBasicJavaType;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
||||||
import org.hibernate.type.internal.BasicTypeImpl;
|
|
||||||
import org.hibernate.type.spi.TypeConfiguration;
|
import org.hibernate.type.spi.TypeConfiguration;
|
||||||
|
|
||||||
public abstract class AbstractArrayJavaType<T, E> extends AbstractClassJavaType<T>
|
public abstract class AbstractArrayJavaType<T, E> extends AbstractClassJavaType<T>
|
||||||
|
@ -47,7 +46,8 @@ public abstract class AbstractArrayJavaType<T, E> extends AbstractClassJavaType<
|
||||||
// Always determine the recommended type to make sure this is a valid basic java type
|
// Always determine the recommended type to make sure this is a valid basic java type
|
||||||
return indicators.getTypeConfiguration().getJdbcTypeRegistry().resolveTypeConstructorDescriptor(
|
return indicators.getTypeConfiguration().getJdbcTypeRegistry().resolveTypeConstructorDescriptor(
|
||||||
indicators.getPreferredSqlTypeCodeForArray(),
|
indicators.getPreferredSqlTypeCodeForArray(),
|
||||||
new BasicTypeImpl<>( componentJavaType, componentJavaType.getRecommendedJdbcType( indicators ) ),
|
indicators.getTypeConfiguration().getBasicTypeRegistry().resolve(
|
||||||
|
componentJavaType, componentJavaType.getRecommendedJdbcType( indicators ) ),
|
||||||
ColumnTypeInformation.EMPTY
|
ColumnTypeInformation.EMPTY
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,6 @@ import org.hibernate.type.descriptor.java.JavaType;
|
||||||
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
||||||
import org.hibernate.type.internal.BasicTypeImpl;
|
|
||||||
import org.hibernate.type.spi.TypeConfiguration;
|
import org.hibernate.type.spi.TypeConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,7 +75,8 @@ public class BasicCollectionJavaType<C extends Collection<E>, E> extends Abstrac
|
||||||
// (even though we only use this inside the if block, we want it to throw here if something wrong)
|
// (even though we only use this inside the if block, we want it to throw here if something wrong)
|
||||||
return indicators.getTypeConfiguration().getJdbcTypeRegistry().resolveTypeConstructorDescriptor(
|
return indicators.getTypeConfiguration().getJdbcTypeRegistry().resolveTypeConstructorDescriptor(
|
||||||
indicators.getPreferredSqlTypeCodeForArray(),
|
indicators.getPreferredSqlTypeCodeForArray(),
|
||||||
new BasicTypeImpl<>( componentJavaType, componentJavaType.getRecommendedJdbcType( indicators ) ),
|
indicators.getTypeConfiguration().getBasicTypeRegistry().resolve(
|
||||||
|
componentJavaType, componentJavaType.getRecommendedJdbcType( indicators ) ),
|
||||||
ColumnTypeInformation.EMPTY
|
ColumnTypeInformation.EMPTY
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue