HHH-17906 Use insert target paths for type inference of SqmValues
This commit is contained in:
parent
d423b52be3
commit
fe4a3fbaf3
|
@ -1586,11 +1586,22 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Values visitValues(SqmValues sqmValues) {
|
public Values visitValues(SqmValues sqmValues) {
|
||||||
|
final List<SqmPath<?>> insertionTargetPaths;
|
||||||
|
if ( currentSqmStatement instanceof SqmInsertStatement<?> ) {
|
||||||
|
insertionTargetPaths = ( (SqmInsertStatement<?>) currentSqmStatement ).getInsertionTargetPaths();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
insertionTargetPaths = null;
|
||||||
|
}
|
||||||
final List<SqmExpression<?>> expressions = sqmValues.getExpressions();
|
final List<SqmExpression<?>> expressions = sqmValues.getExpressions();
|
||||||
final ArrayList<Expression> valuesExpressions = new ArrayList<>( expressions.size() );
|
final ArrayList<Expression> valuesExpressions = new ArrayList<>( expressions.size() );
|
||||||
for ( SqmExpression<?> expression : expressions ) {
|
for ( int i = 0; i < expressions.size(); i++ ) {
|
||||||
// todo: add WriteExpression handling
|
// todo: add WriteExpression handling
|
||||||
valuesExpressions.add( (Expression) expression.accept( this ) );
|
valuesExpressions.add(
|
||||||
|
insertionTargetPaths == null
|
||||||
|
? (Expression) expressions.get( i ).accept( this )
|
||||||
|
: visitWithInferredType( expressions.get( i ), insertionTargetPaths.get( i ) )
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return new Values( valuesExpressions );
|
return new Values( valuesExpressions );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue