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

JdbcTemplate.queryForMap should return first value of equally named columns [SPR-16578] #21120

Closed
spring-projects-issues opened this issue Mar 10, 2018 · 4 comments
Assignees
Labels
in: data type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Mar 10, 2018

Philippe Marschall opened SPR-16578 and commented

When a ResultSet contains multiple columns which are equal when ignoring the case the Map returned by JdbcTemplate#queryForMap contains the value of the last column with the equal name. As an example think of the following query:

SELECT 1 as "X", 2 as "x"
from dual

However the specification of ResultSet states that

Column names used as input to getter methods are case insensitive. When a getter method is called with a column name and several columns have the same name, the value of the first matching column will be returned.


Affects: 5.0.4

Issue Links:

  • #21465 LinkedCaseInsensitiveMap should explicitly implement putIfAbsent and computeIfAbsent

Referenced from: pull request #1739, and commits 7bce750

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Mar 10, 2018

Juergen Hoeller commented

Since existing applications may (accidentally) rely on the current behavior, it is probably only feasible to change this for 5.1.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Mar 26, 2018

Juergen Hoeller commented

We have a similar case in TableMetaDataContext.matchInParameterValuesWithInsertColumns where we currenty use the last case-insensitive key match in the user-provided Map... where we should stop after the first match and proceed with it instead. I'll fix that one for 5.1 as well.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 4, 2018

Philippe Marschall commented

5.1 seems to be open now, could this be merged?

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 11, 2018

Juergen Hoeller commented

This is implemented slightly differently as part of an extended revision (along with #21465) now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants