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-projects-issues opened this issue Nov 7, 2018 · 2 comments
Assignees
Labels
in: data status: backported type: bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues 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-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues 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-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues 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
Labels
in: data status: backported type: bug
Projects
None yet
Development

No branches or pull requests

2 participants