Get rid of Clause parameter in JdbcParameterBindings

This commit is contained in:
Christian Beikov 2023-02-10 11:16:00 +01:00
parent 6e87e4ba1d
commit ecf8e1ce39
13 changed files with 1 additions and 37 deletions

View File

@ -30,7 +30,6 @@ import org.hibernate.metamodel.mapping.SelectableMapping;
import org.hibernate.query.internal.SimpleQueryOptions;
import org.hibernate.query.spi.QueryOptions;
import org.hibernate.spi.NavigablePath;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.SqlAstTranslatorFactory;
import org.hibernate.sql.ast.spi.SimpleFromClauseAccessImpl;
import org.hibernate.sql.ast.spi.SqlAliasBaseManager;
@ -316,7 +315,6 @@ public abstract class AbstractNaturalIdLoader<T> implements NaturalIdLoader<T> {
final JdbcParameterBindings jdbcParamBindings = new JdbcParameterBindingsImpl( jdbcParameters.size() );
int offset = jdbcParamBindings.registerParametersForEachJdbcValue(
id,
Clause.WHERE,
entityDescriptor().getIdentifierMapping(),
jdbcParameters,
session

View File

@ -23,7 +23,6 @@ import org.hibernate.metamodel.mapping.ModelPart;
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
import org.hibernate.metamodel.mapping.internal.EntityCollectionPart;
import org.hibernate.query.spi.QueryOptions;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.SqlAstTranslatorFactory;
import org.hibernate.sql.ast.tree.expression.JdbcParameter;
import org.hibernate.sql.ast.tree.select.SelectStatement;
@ -116,14 +115,12 @@ public class CollectionElementLoaderByIndex implements Loader {
int offset = jdbcParameterBindings.registerParametersForEachJdbcValue(
key,
Clause.WHERE,
attributeMapping.getKeyDescriptor(),
jdbcParameters,
session
);
offset += jdbcParameterBindings.registerParametersForEachJdbcValue(
incrementIndexByBase( index ),
Clause.WHERE,
offset,
attributeMapping.getIndexDescriptor(),
jdbcParameters,

View File

@ -25,7 +25,6 @@ import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.loader.ast.spi.CollectionLoader;
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
import org.hibernate.query.spi.QueryOptions;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.SqlAstTranslatorFactory;
import org.hibernate.sql.ast.tree.expression.JdbcParameter;
import org.hibernate.sql.ast.tree.select.SelectStatement;
@ -180,7 +179,6 @@ public class CollectionLoaderBatchKey implements CollectionLoader {
for ( int i = smallBatchStart; i < smallBatchStart + smallBatchLength; i++ ) {
offset += jdbcParameterBindings.registerParametersForEachJdbcValue(
batchIds[i],
Clause.WHERE,
offset,
getLoadable().getKeyDescriptor(),
jdbcParameters,

View File

@ -22,8 +22,6 @@ import org.hibernate.engine.spi.SubselectFetch;
import org.hibernate.loader.ast.spi.CollectionLoader;
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
import org.hibernate.query.spi.QueryOptions;
import org.hibernate.query.spi.QueryParameterBindings;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.SqlAstTranslatorFactory;
import org.hibernate.sql.ast.tree.expression.JdbcParameter;
import org.hibernate.sql.ast.tree.select.SelectStatement;
@ -99,7 +97,6 @@ public class CollectionLoaderSingleKey implements CollectionLoader {
final JdbcParameterBindings jdbcParameterBindings = new JdbcParameterBindingsImpl( keyJdbcCount );
int offset = jdbcParameterBindings.registerParametersForEachJdbcValue(
key,
Clause.WHERE,
attributeMapping.getKeyDescriptor(),
jdbcParameters,
session

View File

@ -17,11 +17,9 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.metamodel.mapping.EntityMappingType;
import org.hibernate.query.spi.QueryOptions;
import org.hibernate.query.spi.QueryParameterBindings;
import org.hibernate.query.sqm.ComparisonOperator;
import org.hibernate.query.sqm.sql.FromClauseIndex;
import org.hibernate.spi.NavigablePath;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.SqlAstTranslatorFactory;
import org.hibernate.sql.ast.spi.SqlAliasBaseManager;
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
@ -165,7 +163,6 @@ class DatabaseSnapshotExecutor {
int offset = jdbcParameterBindings.registerParametersForEachJdbcValue(
id,
Clause.WHERE,
entityDescriptor.getIdentifierMapping(),
jdbcParameters,
session

View File

@ -23,7 +23,6 @@ import org.hibernate.engine.spi.LoadQueryInfluencers;
import org.hibernate.engine.spi.PersistenceContext;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.engine.spi.Status;
import org.hibernate.engine.spi.SubselectFetch;
import org.hibernate.event.spi.EventSource;
import org.hibernate.event.spi.LoadEvent;
@ -35,7 +34,6 @@ import org.hibernate.mapping.PersistentClass;
import org.hibernate.metamodel.mapping.EntityMappingType;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.query.spi.QueryOptions;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.SqlAstTranslatorFactory;
import org.hibernate.sql.ast.tree.expression.JdbcParameter;
import org.hibernate.sql.ast.tree.select.SelectStatement;
@ -264,7 +262,6 @@ public class MultiIdLoaderStandard<T> implements MultiIdEntityLoader<T> {
offset += jdbcParameterBindings.registerParametersForEachJdbcValue(
id,
Clause.WHERE,
offset,
entityDescriptor.getIdentifierMapping(),
jdbcParameters,

View File

@ -21,7 +21,6 @@ import org.hibernate.loader.ast.spi.MultiNaturalIdLoadOptions;
import org.hibernate.metamodel.mapping.EntityMappingType;
import org.hibernate.metamodel.mapping.ModelPart;
import org.hibernate.query.spi.QueryOptions;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.SqlAstTranslatorFactory;
import org.hibernate.sql.ast.tree.expression.JdbcParameter;
import org.hibernate.sql.ast.tree.select.SelectStatement;
@ -102,7 +101,6 @@ public class MultiNaturalIdLoadingBatcher {
if ( bindValue != null ) {
offset += jdbcParamBindings.registerParametersForEachJdbcValue(
bindValue,
Clause.IRRELEVANT,
offset,
entityDescriptor.getNaturalIdMapping(),
jdbcParameters,
@ -124,7 +122,6 @@ public class MultiNaturalIdLoadingBatcher {
// pad the remaining parameters with null
offset += jdbcParamBindings.registerParametersForEachJdbcValue(
null,
Clause.IRRELEVANT,
offset,
entityDescriptor.getNaturalIdMapping(),
jdbcParameters,

View File

@ -21,8 +21,6 @@ import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.metamodel.mapping.EntityMappingType;
import org.hibernate.query.spi.QueryOptions;
import org.hibernate.query.spi.QueryOptionsAdapter;
import org.hibernate.query.spi.QueryParameterBindings;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.SqlAstTranslatorFactory;
import org.hibernate.sql.ast.tree.expression.JdbcParameter;
import org.hibernate.sql.ast.tree.select.SelectStatement;
@ -120,7 +118,6 @@ public class SingleIdEntityLoaderDynamicBatch<T> extends SingleIdEntityLoaderSup
for ( int i = 0; i < numberOfIds; i++ ) {
offset += jdbcParameterBindings.registerParametersForEachJdbcValue(
idsToLoad[i],
Clause.WHERE,
offset,
getLoadable().getIdentifierMapping(),
jdbcParameters,

View File

@ -18,8 +18,6 @@ import org.hibernate.metamodel.mapping.ModelPart;
import org.hibernate.query.internal.SimpleQueryOptions;
import org.hibernate.query.spi.QueryOptions;
import org.hibernate.query.spi.QueryOptionsAdapter;
import org.hibernate.query.spi.QueryParameterBindings;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.SqlAstTranslatorFactory;
import org.hibernate.sql.ast.tree.expression.JdbcParameter;
import org.hibernate.sql.ast.tree.select.SelectStatement;
@ -134,7 +132,6 @@ public class SingleIdLoadPlan<T> implements SingleEntityLoadPlan {
while ( offset < jdbcParameters.size() ) {
offset += jdbcParameterBindings.registerParametersForEachJdbcValue(
restrictedValue,
Clause.WHERE,
offset,
restrictivePart,
jdbcParameters,

View File

@ -23,7 +23,6 @@ import org.hibernate.metamodel.mapping.ModelPart;
import org.hibernate.metamodel.mapping.SingularAttributeMapping;
import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
import org.hibernate.query.spi.QueryOptions;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.SqlAstTranslatorFactory;
import org.hibernate.sql.ast.tree.expression.JdbcParameter;
import org.hibernate.sql.ast.tree.select.SelectStatement;
@ -88,7 +87,6 @@ public class SingleUniqueKeyEntityLoaderStandard<T> implements SingleUniqueKeyEn
final JdbcParameterBindings jdbcParameterBindings = new JdbcParameterBindingsImpl( jdbcParameters.size() );
int offset = jdbcParameterBindings.registerParametersForEachJdbcValue(
ukValue,
Clause.WHERE,
uniqueKeyAttribute,
jdbcParameters,
session
@ -145,7 +143,6 @@ public class SingleUniqueKeyEntityLoaderStandard<T> implements SingleUniqueKeyEn
final JdbcParameterBindings jdbcParameterBindings = new JdbcParameterBindingsImpl( jdbcParameters.size() );
int offset = jdbcParameterBindings.registerParametersForEachJdbcValue(
ukValue,
Clause.WHERE,
uniqueKeyAttribute,
jdbcParameters,
session

View File

@ -22,7 +22,6 @@ import org.hibernate.loader.ast.internal.NoCallbackExecutionContext;
import org.hibernate.metamodel.mapping.AttributeMapping;
import org.hibernate.metamodel.mapping.EntityMappingType;
import org.hibernate.query.spi.QueryOptions;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.tree.expression.JdbcParameter;
import org.hibernate.sql.ast.tree.select.SelectStatement;
import org.hibernate.sql.exec.internal.JdbcParameterBindingsImpl;
@ -124,7 +123,6 @@ public class GeneratedValuesProcessor {
final JdbcParameterBindings jdbcParamBindings = new JdbcParameterBindingsImpl( jdbcParameters.size() );
int offset = jdbcParamBindings.registerParametersForEachJdbcValue(
id,
Clause.WHERE,
entityDescriptor.getIdentifierMapping(),
jdbcParameters,
session

View File

@ -48,7 +48,6 @@ import org.hibernate.query.sqm.tree.expression.SqmJpaCriteriaParameterWrapper;
import org.hibernate.query.sqm.tree.expression.SqmParameter;
import org.hibernate.query.sqm.tree.jpa.ParameterCollector;
import org.hibernate.query.sqm.tree.select.SqmSelectStatement;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.SqlTreeCreationException;
import org.hibernate.sql.ast.tree.expression.JdbcParameter;
import org.hibernate.sql.ast.tree.from.TableGroup;
@ -389,7 +388,6 @@ public class SqmUtil {
int offset = jdbcParameterBindings.registerParametersForEachJdbcValue(
bindValue,
Clause.IRRELEVANT,
parameterType,
jdbcParams,
session

View File

@ -12,7 +12,6 @@ import java.util.List;
import java.util.function.BiConsumer;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.metamodel.mapping.BasicValuedMapping;
@ -25,7 +24,6 @@ import org.hibernate.query.spi.QueryParameterBindings;
import org.hibernate.query.spi.QueryParameterImplementor;
import org.hibernate.query.sql.internal.NativeQueryImpl;
import org.hibernate.query.sql.spi.ParameterOccurrence;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.tree.expression.JdbcParameter;
import org.hibernate.sql.exec.internal.JdbcParameterBindingImpl;
import org.hibernate.sql.exec.internal.JdbcParameterImpl;
@ -75,16 +73,14 @@ public interface JdbcParameterBindings {
default int registerParametersForEachJdbcValue(
Object value,
Clause clause,
Bindable bindable,
List<JdbcParameter> jdbcParameters,
SharedSessionContractImplementor session) {
return registerParametersForEachJdbcValue( value, clause, 0, bindable, jdbcParameters, session );
return registerParametersForEachJdbcValue( value, 0, bindable, jdbcParameters, session );
}
default int registerParametersForEachJdbcValue(
Object value,
Clause clause,
int offset,
Bindable bindable,
List<JdbcParameter> jdbcParameters,