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
NamedParameterJdbcTemplate provides a protected method getParsedSql to obtain a ParsedSql object. This allows for custom sql modification prior to being passed off to the internal NamedParameterUtils class which offers no callbacks.
SimpleJdbcTemplate delegates to NamedParameterJdbcOperations (default being NamedParameterJdbcTemplate) for all methods using named parameters except for the batchUpdate methods. These methods use the private method doExecuteBatchUpdateWithNamedParameters which directly invokes NamedParameterUtils.
Thus, in order to handle custom sql modification for batchUpdates, SimpleJdbcTemplate must be overridden to not only use a custom subclass for the NamedParameterJdbcOperations but to invoke the custom logic in the applicable batchUpdate methods.
It would be nice to add batchUpdate to NamedParameterJdbcTemplate (as requested in #8007) and then delegate to this from SimpleJdbcTemplate. In this way, all sql parsing would be routed through an overridable getParsedSql.
Steve Ungerer opened SPR-5162 and commented
NamedParameterJdbcTemplate provides a protected method getParsedSql to obtain a ParsedSql object. This allows for custom sql modification prior to being passed off to the internal NamedParameterUtils class which offers no callbacks.
SimpleJdbcTemplate delegates to NamedParameterJdbcOperations (default being NamedParameterJdbcTemplate) for all methods using named parameters except for the batchUpdate methods. These methods use the private method doExecuteBatchUpdateWithNamedParameters which directly invokes NamedParameterUtils.
Thus, in order to handle custom sql modification for batchUpdates, SimpleJdbcTemplate must be overridden to not only use a custom subclass for the NamedParameterJdbcOperations but to invoke the custom logic in the applicable batchUpdate methods.
It would be nice to add batchUpdate to NamedParameterJdbcTemplate (as requested in #8007) and then delegate to this from SimpleJdbcTemplate. In this way, all sql parsing would be routed through an overridable getParsedSql.
Affects: 2.0.8, 2.5 final, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.5
Issue Links:
The text was updated successfully, but these errors were encountered: