spring-data-relational icon indicating copy to clipboard operation
spring-data-relational copied to clipboard

Should NOT_IN judgment be added to QueryMapper's convertValue function implementation?

Open yande2011 opened this issue 1 year ago • 2 comments

The current implementation is like this @Nullable private Object convertValue(Comparator comparator, @Nullable Object value, TypeInformation<?> typeHint) {

	if (Comparator.IN.equals(comparator) && value instanceof Collection<?> collection && !collection.isEmpty()) {

		Collection<Object> mapped = new ArrayList<>(collection.size());

		for (Object o : collection) {
			mapped.add(convertValue(o, typeHint));
		}

		return mapped;
	}

	return convertValue(value, typeHint);
}

My scenario is like this. I implemented the conversion from Collection to String myself. If NOT_IN is not determined before, the subsequent conversion function first determines whether conversion is possible, resulting in the wrong type of conversion.

yande2011 avatar Feb 29 '24 03:02 yande2011

It should be added. Do you want to submit a pull request?

mp911de avatar Feb 29 '24 07:02 mp911de

It should be added. Do you want to submit a pull request?

ok, i'll submit.

yande2011 avatar Feb 29 '24 09:02 yande2011