Add support for arbitrary where clauses in Single Query Loading.
Closes #1601 Original pull request: #1617
This commit is contained in:
committed by
Mark Paluch
parent
6fb6110ca0
commit
0fdeaebbee
@@ -373,12 +373,10 @@ public class QueryMapper {
|
||||
|
||||
mappedValue = convertValue(comparator, parameter.getValue(), propertyField.getTypeHint());
|
||||
typeHint = getTypeHint(mappedValue, actualType.getType(), parameter);
|
||||
} else if (criteria.getValue() instanceof ValueFunction) {
|
||||
} else if (criteria.getValue() instanceof ValueFunction<?> valueFunction) {
|
||||
|
||||
ValueFunction<Object> valueFunction = (ValueFunction<Object>) criteria.getValue();
|
||||
Object value = valueFunction.apply(getEscaper(comparator));
|
||||
mappedValue = valueFunction.transform(v -> convertValue(comparator, v, propertyField.getTypeHint())).apply(getEscaper(comparator));
|
||||
|
||||
mappedValue = convertValue(comparator, value, propertyField.getTypeHint());
|
||||
typeHint = actualType.getType();
|
||||
} else {
|
||||
|
||||
|
||||
@@ -111,18 +111,14 @@ public class UpdateMapper extends QueryMapper {
|
||||
Object mappedValue;
|
||||
Class<?> typeHint;
|
||||
|
||||
if (value instanceof Parameter) {
|
||||
|
||||
Parameter parameter = (Parameter) value;
|
||||
if (value instanceof Parameter parameter) {
|
||||
|
||||
mappedValue = convertValue(parameter.getValue(), propertyField.getTypeHint());
|
||||
typeHint = getTypeHint(mappedValue, actualType.getType(), parameter);
|
||||
|
||||
} else if (value instanceof ValueFunction) {
|
||||
} else if (value instanceof ValueFunction<?> valueFunction) {
|
||||
|
||||
ValueFunction<Object> valueFunction = (ValueFunction<Object>) value;
|
||||
|
||||
mappedValue = convertValue(valueFunction.apply(Escaper.DEFAULT), propertyField.getTypeHint());
|
||||
mappedValue = valueFunction.transform(v -> convertValue(v, propertyField.getTypeHint())).apply(Escaper.DEFAULT);
|
||||
|
||||
if (mappedValue == null) {
|
||||
return Assignments.value(column, SQL.nullLiteral());
|
||||
|
||||
Reference in New Issue
Block a user