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 Issues in data modules (jdbc, orm, oxm, tx) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

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:

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

Backported to: 5.0.11, 4.3.21

@spring-projects-issues
Copy link
Collaborator Author

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

Vinay Shankar commented

Thank you for the fix. 

@spring-projects-issues spring-projects-issues added type: bug A general bug in: data Issues in data modules (jdbc, orm, oxm, tx) status: backported An issue that has been backported to maintenance branches labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 5.1.3 milestone Jan 11, 2019
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) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants