Skip to content

Make the JdbcClient method update(KeyHolder) work with positional parameters #31122

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

Closed
hansdesmet opened this issue Aug 28, 2023 · 5 comments
Closed
Assignees
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: bug A general bug
Milestone

Comments

@hansdesmet
Copy link

Most of the methods of JdbcClient work with positional parameters in the sql statement
als well as with named parameters 👍.

The method update(KeyHolder generatedKeyHolder) works only with named parameters 😔.
It throws an exception when I try to use it with positional parameters.
I put a project on https://github.com/hansdesmet/jdbcclientproposal that shows the problem.

Is it possible to make this methos also work with positional parameters ?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Aug 28, 2023
@jhoeller
Copy link
Contributor

That's an oversight, we're accidentally delegating to JdbcTemplate's general update method with varargs there. We also seem to lack a unit test for the KeyHolder variant there.

@jhoeller jhoeller added in: data Issues in data modules (jdbc, orm, oxm, tx) type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Aug 28, 2023
@jhoeller jhoeller added this to the 6.1.0-RC1 milestone Aug 28, 2023
@jhoeller jhoeller self-assigned this Aug 28, 2023
@hansdesmet
Copy link
Author

I upgraded the project that i used in this issue (https://github.com/hansdesmet/jdbcclientproposal) to Spring Boot 3.2.0-M3.
I still get the same exception 😔.
Could you please check ? (the project uses an H2 database, so it' easy to run on any computer)

@sbrannen
Copy link
Member

sbrannen commented Sep 22, 2023

Thanks for updating the sample app. I've confirmed that the Maven build fails.

We'll look into it.

@hansdesmet
Copy link
Author

I've added another sample project on https://github.com/hansdesmet/jdbcclientproposalmysql.git.
This project uses MySQL in a test container.
This project also shows the problem, but with another kind of exception than when using H2.

@sbrannen
Copy link
Member

Since this issue was closed in 6.1 M5, let's continue the discussion in the follow-up issue I've just created.

@sbrannen sbrannen changed the title Make the JdbcClient method update(KeyHolder generatedKeyHolder) work with positional parameters Make the JdbcClient method update(KeyHolder) work with positional parameters Sep 25, 2023
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: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants