mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-22 14:09:25 +00:00
Invert findColumn fallback to try common underscore naming first
Closes gh-37297
This commit is contained in:
+4
-4
@@ -130,12 +130,12 @@ public class SimplePropertyRowMapper<T> implements RowMapper<T> {
|
||||
String name = this.constructorParameterNames[i];
|
||||
int index;
|
||||
try {
|
||||
// Try direct name match first
|
||||
index = rs.findColumn(name);
|
||||
// Try common underscored name match first
|
||||
index = rs.findColumn(JdbcUtils.convertPropertyNameToUnderscoreName(name));
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
// Try underscored name match instead
|
||||
index = rs.findColumn(JdbcUtils.convertPropertyNameToUnderscoreName(name));
|
||||
// Try direct name match (typically with camelCase) instead
|
||||
index = rs.findColumn(name);
|
||||
}
|
||||
TypeDescriptor td = this.constructorParameterTypes[i];
|
||||
Object value = JdbcUtils.getResultSetValue(rs, index, td.getType());
|
||||
|
||||
Reference in New Issue
Block a user