Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discrepancy between sql parsing in SimpleJdbcTemplate and NamedParameterJdbcTemplate when doing batchUpdates [SPR-5162] #9835

Closed
spring-projects-issues opened this issue Sep 17, 2008 · 0 comments
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Sep 17, 2008

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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant