JdbcTemplate delegates parameters binding to StatementCreatorUtils
, which uses a fallback if sqlType and java type are unknown:
https://github.com/spring-projects/spring-framework/blob/582b94d50ec880d06fecd506305c412c2a89b933/spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCreatorUtils.java#L414
Can we handle enum values as Strings here?
It will be consistent in my opinion, because other classes like BeanPropertyRowMapper
support enums.
It also can be handled in SqlParameterSource
implementations if getSqlType will return Types.VARCHAR
for enums.
Comment From: snicoll
I don't think that's a good idea to convert the input value in such a case. Also, it's asymmetrical as you can't get back the value if it's set this way. Thanks for the suggestion, in any case.