Description
Joris Kuipers opened SPR-5678 and commented
Currently, ArgPreparedStatementSetter.setValues simply applies the values in the args array it was created with to the given PreparedStatement. That means that if there are less arguments than placeholders, the remaining placeholders will be null. This is valid behavior in some cases, but in many cases I'd argue that this indicates a programmer error (forgetting a parameter).
It might be nice to add an option to setValues to optionally check for a matching count of arguments and placeholders. The latter can be obtained from the PreparedStatement's ParameterMetaData. The JdbcTemplate can then be updated to enable this feature so this programming error would be caught early, instead of indirectly by running the statement with accidental null values.
By disabling the option by default everything remains backwards compatible.
Affects: 2.5.6