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

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

spring-projects-issues opened this issue Dec 7, 2016 · 1 comment

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

spring-projects-issues opened this issue Dec 7, 2016 · 1 comment


Copy link

@spring-projects-issues 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:

  • #18461 BeanPropertyRowMapper should use ConversionService for date-time support
  • #19515 Shared DefaultConversionService instance e.g. for BeanPropertyRowMapper

Referenced from: commits 278a625, 4e41f74

Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Dec 8, 2016

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
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.