-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Support converting underscores column name to camel case property name for projecting native query #3472
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
Conversation
@@ -378,6 +403,14 @@ public boolean containsKey(Object key) { | |||
tuple.get((String) key); | |||
return true; | |||
} catch (IllegalArgumentException e) { | |||
if (nativeQuery) { | |||
try { | |||
tuple.get(JdbcUtils.convertPropertyNameToUnderscoreName((String) key)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of customizing the Map
, it would make sense to have a custom Tuple
wrapper that handles the conversion.
Consider a tuple that would contain first_name
and firstName
elements. It is impossible to tell in which order these should appear in a map nor which value to return in a Set<Map.Entry>
.
Attempting snake-case to camel-case conversion on value absence makes sense, for the rest we should keep the functionality as-is.
The Tuple
wrapper would delegate all enumerative calls to the Tuple
delegate while get(…)
calls are augmented for property name conversion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, updated now, please review again.
…e for projecting native query > By default, Spring Boot configures the physical naming strategy with CamelCaseToUnderscoresNamingStrategy. Then we should convert underscores back to camel case. Fix spring-projectsGH-3462
Thank you for your contribution. That's merged and polished now. |
Then we should convert underscores back to camel case.
Fix GH-3462