Convert only contents of collections using StringBasedJdbcQuery.

Contents of Iterables that aren't collections will not be converted individually.

Closes #1343
Original pull request: #1356
This commit is contained in:
Jens Schauder
2022-10-11 15:45:17 +02:00
committed by Mark Paluch
parent 6855b9bd25
commit d1e039a387
2 changed files with 45 additions and 2 deletions

View File

@@ -20,6 +20,7 @@ import static org.springframework.data.jdbc.repository.query.JdbcQueryExecution.
import java.lang.reflect.Constructor;
import java.sql.SQLType;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.springframework.beans.BeanUtils;
@@ -189,7 +190,7 @@ public class StringBasedJdbcQuery extends AbstractJdbcQuery {
Assert.notNull(type, "@Query parameter type could not be resolved");
JdbcValue jdbcValue;
if (value instanceof Iterable) {
if (value instanceof Collection && resolvableType.hasGenerics()) {
List<Object> mapped = new ArrayList<>();
SQLType jdbcType = null;