Description
Hello, the following example doesn't work any more after upgrading spring-boot version from 3.3.2
to 3.3.3 / 3.3.4.
uuid is a BINARY(16) column in a table in MariaDB 10.6.18.
@Query(
"(SELECT "
+ ALL_COLUMNS
+ " FROM user WHERE uuid IN (:uuids)) "
List<User> findAllByUuids(List<byte[]> uuids);
It looks like the problem is caused by this fix in the class org.springframework.data.jdbc.repository.query.StringBasedJdbcQuery
.
I debugged a bit and it looks like in the version 3.3.3
in the function StringBasedJdbcQuery.bindParameters(RelationalParameterAccessor accessor)
a new function writeValue is called which iterates through each byte[] using writeJdbcValue and gets a jdbcValue for each byte in the array - jdbcType VARBINARY. The end result of the bindParameters' value is ArrayList<Object[16]> with Byte items.
If I understand correctly in the 3.3.2
version the bindParameters
function uses convertAndAddParameter
which calls writeJdbcValue
for a byte[] and the result jdbcType
is BINARY
. The result value of bindParameters
is ArrayList<byte[]>
.
The error for List.of([-8, 7, -57, -71, -23, -77, 70, 24, -70, -19, -113, 98, -9, 0, 121, 119])
org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar
Caused by: java.sql.SQLSyntaxErrorException: (conn=714) Could not convert [-8] to -3
Maybe a check for treating List<byte[]> should be added to differentiate from the tuple processing ?
Thanks in advance !