@@ -348,43 +348,44 @@ private Condition mapCondition(CriteriaDefinition criteria, MutableBindings bind
348348 Object mappedValue ;
349349 Class <?> typeHint ;
350350
351+ Comparator comparator = criteria .getComparator ();
351352 if (criteria .getValue () instanceof SettableValue ) {
352353
353354 SettableValue settableValue = (SettableValue ) criteria .getValue ();
354355
355- mappedValue = convertValue (settableValue .getValue (), propertyField .getTypeHint ());
356+ mappedValue = convertValue (comparator , settableValue .getValue (), propertyField .getTypeHint ());
356357 typeHint = getTypeHint (mappedValue , actualType .getType (), settableValue );
357358 } else if (criteria .getValue () instanceof Parameter ) {
358359
359360 Parameter parameter = (Parameter ) criteria .getValue ();
360361
361- mappedValue = convertValue (parameter .getValue (), propertyField .getTypeHint ());
362+ mappedValue = convertValue (comparator , parameter .getValue (), propertyField .getTypeHint ());
362363 typeHint = getTypeHint (mappedValue , actualType .getType (), parameter );
363364 } else if (criteria .getValue () instanceof ValueFunction ) {
364365
365366 ValueFunction <Object > valueFunction = (ValueFunction <Object >) criteria .getValue ();
366- Object value = valueFunction .apply (getEscaper (criteria . getComparator () ));
367+ Object value = valueFunction .apply (getEscaper (comparator ));
367368
368- mappedValue = convertValue (value , propertyField .getTypeHint ());
369+ mappedValue = convertValue (comparator , value , propertyField .getTypeHint ());
369370 typeHint = actualType .getType ();
370371 } else {
371372
372373 Object value = criteria .getValue ();
373374
374375 // Translate bind values for comparators that are bound as value but don't include a value.
375376 if (value == null ) {
376- if (criteria . getComparator () == Comparator .IS_TRUE ) {
377+ if (comparator == Comparator .IS_TRUE ) {
377378 value = true ;
378- } else if (criteria . getComparator () == Comparator .IS_FALSE ) {
379+ } else if (comparator == Comparator .IS_FALSE ) {
379380 value = false ;
380381 }
381382 }
382383
383- mappedValue = convertValue (value , propertyField .getTypeHint ());
384+ mappedValue = convertValue (comparator , value , propertyField .getTypeHint ());
384385 typeHint = actualType .getType ();
385386 }
386387
387- return createCondition (column , mappedValue , typeHint , bindings , criteria . getComparator () , criteria .isIgnoreCase ());
388+ return createCondition (column , mappedValue , typeHint , bindings , comparator , criteria .isIgnoreCase ());
388389 }
389390
390391 private Escaper getEscaper (Comparator comparator ) {
@@ -427,6 +428,24 @@ public Parameter getBindValue(Parameter value) {
427428 return Parameter .from (convertValue (value .getValue (), ClassTypeInformation .OBJECT ));
428429 }
429430
431+ @ Nullable
432+ private Object convertValue (@ Nullable Comparator comparator , @ Nullable Object value , TypeInformation <?> typeHint ) {
433+
434+ if (Comparator .IN .equals (comparator ) && value instanceof Collection <?> && !((Collection <?>) value ).isEmpty ()) {
435+
436+ Collection <?> collection = (Collection <?>) value ;
437+ Collection <Object > mapped = new ArrayList <>(collection .size ());
438+
439+ for (Object o : collection ) {
440+ mapped .add (convertValue (o , typeHint ));
441+ }
442+
443+ return mapped ;
444+ }
445+
446+ return convertValue (value , typeHint );
447+ }
448+
430449 @ Nullable
431450 protected Object convertValue (@ Nullable Object value , TypeInformation <?> typeInformation ) {
432451
@@ -449,23 +468,6 @@ protected Object convertValue(@Nullable Object value, TypeInformation<?> typeInf
449468 return Pair .of (first , second );
450469 }
451470
452- if (value instanceof Iterable ) {
453-
454- List <Object > mapped = new ArrayList <>();
455-
456- for (Object o : (Iterable <?>) value ) {
457- mapped .add (convertValue (o , typeInformation .getActualType () != null ? typeInformation .getRequiredActualType ()
458- : ClassTypeInformation .OBJECT ));
459- }
460-
461- return mapped ;
462- }
463-
464- if (value .getClass ().isArray ()
465- && (ClassTypeInformation .OBJECT .equals (typeInformation ) || typeInformation .isCollectionLike ())) {
466- return value ;
467- }
468-
469471 return this .converter .writeValue (value , typeInformation );
470472 }
471473
0 commit comments