You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're using a custom postgres enum in our application. To support this, we've written a custom converter to set the type for enums to OTHER. That worked great with 6.0.13 but it's broken in 6.1.1 when we're using the enum as query parameter in the repository.
Our configuration:
@Configuration
public class PostgresConfig extends AbstractJdbcConfiguration {
@Override
protected List<?> userConverters() {
return List.of(new PostgresEnumConverter());
}
public static class PostgresEnumConverter implements Converter<Enum<?>, JdbcValue> {
@Override
public JdbcValue convert(final Enum<?> source) {
return JdbcValue.of(source, JDBCType.OTHER);
}
}
}
After debugging into PreparedStatementCreatorFactory and NamedParameterUtils.buildSqlParameterList the problem seems to be, that the wrapping parameter source org.springframework.data.jdbc.repository.query.EscapingParameterSource doesn't implement the delegating method getSqlType. The underlying MapSqlParameterSource has the correct sql type but isn't used and the factory falls back to UNKNOWN and the statement ended in a SQL Exception Can't infer the SQL type to use for an instance of com.xxxx. Use setObject() with an explicit Types value to specify the type to use.
this is a blocker for us and we were forced to roll back the update
The text was updated successfully, but these errors were encountered:
We're using a custom postgres enum in our application. To support this, we've written a custom converter to set the type for enums to
OTHER
. That worked great with 6.0.13 but it's broken in 6.1.1 when we're using the enum as query parameter in the repository.Our configuration:
After debugging into
PreparedStatementCreatorFactory
andNamedParameterUtils.buildSqlParameterList
the problem seems to be, that the wrapping parameter sourceorg.springframework.data.jdbc.repository.query.EscapingParameterSource
doesn't implement the delegating methodgetSqlType
. The underlyingMapSqlParameterSource
has the correct sql type but isn't used and the factory falls back toUNKNOWN
and the statement ended in a SQL ExceptionCan't infer the SQL type to use for an instance of com.xxxx. Use setObject() with an explicit Types value to specify the type to use.
this is a blocker for us and we were forced to roll back the update
The text was updated successfully, but these errors were encountered: