Skip to content

Commit eaa3d66

Browse files
committed
Use first column in case of duplicate columns.
Also, fallback on column names when label is not present. See #1680 Original pull request #1825
1 parent faee851 commit eaa3d66

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/RowDocumentResultSetExtractor.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ static RowDocument toRowDocument(ResultSet resultSet) throws SQLException {
7373
for (int i = 0; i < columnCount; i++) {
7474

7575
Object rsv = JdbcUtils.getResultSetValue(resultSet, i + 1);
76-
String columnName = md.getColumnLabel(i + 1);
77-
Object old = document.put(columnName, rsv instanceof Array a ? a.getArray() : rsv);
76+
String columnName = JdbcUtils.lookupColumnName(md, i+1);
77+
Object old = document.putIfAbsent(columnName, rsv instanceof Array a ? a.getArray() : rsv);
7878
if (old != null) {
7979
log.warn(DUPLICATE_COLUMN_WARNING, columnName, i);
8080
}

0 commit comments

Comments
 (0)