Skip to content

Update JdbcUtils to improve enum support [SPR-14990] #19556

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
spring-projects-issues opened this issue Dec 7, 2016 · 1 comment
Closed

Update JdbcUtils to improve enum support [SPR-14990] #19556

spring-projects-issues opened this issue Dec 7, 2016 · 1 comment
Assignees
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Dec 7, 2016

Yanming Zhou opened SPR-14990 and commented

Since we have StringToEnumConverter and IntegerToEnumConverter in shared DefaultConversionService, BeanPropertyRowMapper supports Enum now, but there is a little problem with jdbc 4.1 rs.getObject(index,type), if type is Enum it will always return null, actually we need String or Integer here, use rs.getObject(index) is fine.


Affects: 4.3.4

Reference URL: #1259

Issue Links:

Referenced from: commits 278a625, 4e41f74

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Thanks for raising this!

I've rolled a slightly more extensive change into JdbcUtils.getResultSetValue: We check for an enum target type but manually call rs.getObject then, evaluating the outcome to a String or number, and enforcing rs.getString for anything else. Otherwise we'd fail to handle enums on Postgres where rs.getObject returns a PGObject for an enum column.

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: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants