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
For the moment there is a constructor SimpleJdbcInsert(JdbcTemplate jdbcTemplate).
If you would add a constructor SimpleJdbcInsert(NamedParameterJdbcTemplate namedParameterJdbcTemplate) this would be handy if you only inject a NamedParameterJdbcTemplate bean in your repository bean, not a JdbcTemplate bean.
Since SimpleJdbcInsert is actually lower-level than NamedParameterJdbcTemplate in terms of the package layering, a dedicated constructor doesn't seem to be feasible.
That said, we can nevertheless simplify such an arrangement by giving NamedParameterJdbcTemplate a getJdbcTemplate() method (since currently it only has getJdbcOperations() at the interface level which isn't sufficient for the purposes here).
This allows for the following code to work:
new SimpleJdbcInsert(namedParameterJdbcTemplate.getJdbcTemplate())
instead of the currently needed downcast:
new SimpleJdbcInsert((JdbcTemplate) namedParameterJdbcTemplate.getJdbcOperations())
I'll schedule that part for 5.0.3. I hope that's sufficient for your purposes?
Hans Desmet opened SPR-16241 and commented
For the moment there is a constructor SimpleJdbcInsert(JdbcTemplate jdbcTemplate).
If you would add a constructor SimpleJdbcInsert(NamedParameterJdbcTemplate namedParameterJdbcTemplate) this would be handy if you only inject a NamedParameterJdbcTemplate bean in your repository bean, not a JdbcTemplate bean.
Affects: 5.0.2
Issue Links:
Referenced from: commits b55a263
The text was updated successfully, but these errors were encountered: