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

NamedParameterJdbcTemplate batchUpdate returns an array of size 1 when the batchArgs passed is an empty array [SPR-17476] #22008

Closed
spring-issuemaster opened this Issue Nov 7, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

spring-issuemaster commented Nov 7, 2018

Vinay Shankar opened SPR-17476 and commented

The batchUpdate method of NamedParameterJdbcTemplate returns an array of size 1 when the batchArgs passed is an empty array.

int[] batchUpdate(String sql, SqlParameterSource[] batchArgs);

The batchUpdate method of the JdbcTemplate returns an empty array when the batchArgs passed is an empty array.

public int[] batchUpdate(String sql, List<Object[]> batchArgs) throws DataAccessException;

I am using spring-jdbc 4.2.9


Issue Links:

  • #21935 Support list in IN clause in NamedParameterJdbcTemplate.batchUpdate

Referenced from: commits 4f5ae22, 362c59c, 0167b79

Backported to: 5.0.11, 4.3.21

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

spring-issuemaster commented Nov 8, 2018

Juergen Hoeller commented

Good catch, we accidentally returned an array with 0 as an element instead of 0 length there. Fixed for 5.1.3 now, and backported to 5.0.11 and 4.3.21 as well.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

spring-issuemaster commented Nov 8, 2018

Vinay Shankar commented

Thank you for the fix. 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.