HHH-17279 Get rid of MultiTableSqmMutationConverter#visitInsertionTargetPaths
This commit is contained in:
parent
e6f26e0754
commit
1cbbf9f50a
|
@ -165,19 +165,6 @@ public class MultiTableSqmMutationConverter extends BaseSqmToSqlAstConverter<Sta
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Specialized hook to visit the target paths defined by the insert SQM.
|
||||
*/
|
||||
public AdditionalInsertValues visitInsertionTargetPaths(
|
||||
BiConsumer<Assignable, List<ColumnReference>> targetColumnReferenceConsumer,
|
||||
SqmInsertStatement<?> sqmStatement,
|
||||
EntityPersister entityDescriptor,
|
||||
TableGroup tableGroup,
|
||||
SqmParameterResolutionConsumer parameterResolutionConsumer) {
|
||||
this.parameterResolutionConsumer = parameterResolutionConsumer;
|
||||
return visitInsertionTargetPaths( targetColumnReferenceConsumer, sqmStatement, entityDescriptor, tableGroup );
|
||||
}
|
||||
|
||||
public Predicate visitWhereClause(
|
||||
SqmWhereClause sqmWhereClause,
|
||||
Consumer<ColumnReference> restrictionColumnReferenceConsumer,
|
||||
|
|
|
@ -9,8 +9,6 @@ package org.hibernate.query.sqm.mutation.internal.cte;
|
|||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
|
@ -186,14 +184,6 @@ public class CteInsertHandler implements InsertHandler {
|
|||
);
|
||||
final TableGroup insertingTableGroup = sqmConverter.getMutatingTableGroup();
|
||||
|
||||
final Map<SqmParameter<?>, List<List<JdbcParameter>>> parameterResolutions;
|
||||
if ( domainParameterXref.getSqmParameterCount() == 0 ) {
|
||||
parameterResolutions = Collections.emptyMap();
|
||||
}
|
||||
else {
|
||||
parameterResolutions = new IdentityHashMap<>();
|
||||
}
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// visit the insertion target using our special converter, collecting
|
||||
// information about the target paths
|
||||
|
@ -201,7 +191,6 @@ public class CteInsertHandler implements InsertHandler {
|
|||
final int size = sqmStatement.getInsertionTargetPaths().size();
|
||||
final List<Map.Entry<List<CteColumn>, Assignment>> targetPathColumns = new ArrayList<>( size );
|
||||
final List<CteColumn> targetPathCteColumns = new ArrayList<>( size );
|
||||
final Map<SqmParameter<?>, MappingModelExpressible<?>> paramTypeResolutions = new LinkedHashMap<>();
|
||||
final NamedTableReference entityTableReference = new NamedTableReference(
|
||||
cteTable.getTableExpression(),
|
||||
TemporaryTable.DEFAULT_ALIAS,
|
||||
|
@ -236,14 +225,7 @@ public class CteInsertHandler implements InsertHandler {
|
|||
},
|
||||
sqmInsertStatement,
|
||||
entityDescriptor,
|
||||
insertingTableGroup,
|
||||
(sqmParameter, mappingType, jdbcParameters) -> {
|
||||
parameterResolutions.computeIfAbsent(
|
||||
sqmParameter,
|
||||
k -> new ArrayList<>( 1 )
|
||||
).add( jdbcParameters );
|
||||
paramTypeResolutions.put( sqmParameter, mappingType );
|
||||
}
|
||||
insertingTableGroup
|
||||
);
|
||||
|
||||
final boolean assignsId = targetPathCteColumns.contains( cteTable.getCteColumns().get( 0 ) );
|
||||
|
@ -604,7 +586,7 @@ public class CteInsertHandler implements InsertHandler {
|
|||
targetPathColumns,
|
||||
assignsId,
|
||||
sqmConverter,
|
||||
parameterResolutions,
|
||||
sqmConverter.getJdbcParamsBySqmParam(),
|
||||
factory
|
||||
);
|
||||
|
||||
|
@ -641,7 +623,7 @@ public class CteInsertHandler implements InsertHandler {
|
|||
new SqmParameterMappingModelResolutionAccess() {
|
||||
@Override @SuppressWarnings("unchecked")
|
||||
public <T> MappingModelExpressible<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
||||
return (MappingModelExpressible<T>) paramTypeResolutions.get(parameter);
|
||||
return (MappingModelExpressible<T>) sqmConverter.getSqmParameterMappingModelExpressibleResolutions().get( parameter );
|
||||
}
|
||||
},
|
||||
executionContext.getSession()
|
||||
|
|
|
@ -134,20 +134,11 @@ public class TableBasedInsertHandler implements InsertHandler {
|
|||
|
||||
final TableGroup insertingTableGroup = converterDelegate.getMutatingTableGroup();
|
||||
|
||||
final Map<SqmParameter<?>, List<List<JdbcParameter>>> parameterResolutions;
|
||||
if ( domainParameterXref.getSqmParameterCount() == 0 ) {
|
||||
parameterResolutions = Collections.emptyMap();
|
||||
}
|
||||
else {
|
||||
parameterResolutions = new IdentityHashMap<>();
|
||||
}
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// visit the insertion target using our special converter, collecting
|
||||
// information about the target paths
|
||||
|
||||
final List<Assignment> targetPathColumns = new ArrayList<>();
|
||||
final Map<SqmParameter<?>, MappingModelExpressible<?>> paramTypeResolutions = new LinkedHashMap<>();
|
||||
final NamedTableReference entityTableReference = new NamedTableReference(
|
||||
entityTable.getTableExpression(),
|
||||
TemporaryTable.DEFAULT_ALIAS,
|
||||
|
@ -162,14 +153,7 @@ public class TableBasedInsertHandler implements InsertHandler {
|
|||
},
|
||||
sqmInsertStatement,
|
||||
entityDescriptor,
|
||||
insertingTableGroup,
|
||||
(sqmParameter, mappingType, jdbcParameters) -> {
|
||||
parameterResolutions.computeIfAbsent(
|
||||
sqmParameter,
|
||||
k -> new ArrayList<>( 1 )
|
||||
).add( jdbcParameters );
|
||||
paramTypeResolutions.put( sqmParameter, mappingType );
|
||||
}
|
||||
insertingTableGroup
|
||||
);
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -329,9 +313,9 @@ public class TableBasedInsertHandler implements InsertHandler {
|
|||
tableReferenceByAlias,
|
||||
targetPathColumns,
|
||||
insertStatement,
|
||||
parameterResolutions,
|
||||
converterDelegate.getJdbcParamsBySqmParam(),
|
||||
sessionUidParameter,
|
||||
paramTypeResolutions,
|
||||
converterDelegate.getSqmParameterMappingModelExpressibleResolutions(),
|
||||
executionContext
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue