Skip to content

Commit 2762679

Browse files
committed
[#1550] Make ResultSetAdaptor#findName case insensitive
Some dbs return the column names uppercased
1 parent 90759e8 commit 2762679

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

hibernate-reactive-core/src/main/java/org/hibernate/reactive/adaptor/impl/ResultSetAdaptor.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,16 @@ public Object getObject(String columnLabel) {
494494

495495
@Override
496496
public int findColumn(String columnLabel) {
497-
return rows.columnsNames().indexOf( columnLabel ) + 1;
498-
// return row.getColumnIndex( columnLabel );
497+
// JDBC parameters index start from 1
498+
int index = 1;
499+
for ( String column : rows.columnsNames() ) {
500+
// Some dbs, like Oracle and Db2, return the column names always in uppercase
501+
if ( column.equalsIgnoreCase( columnLabel ) ) {
502+
return index;
503+
}
504+
index++;
505+
}
506+
return -1;
499507
}
500508

501509
@Override

0 commit comments

Comments
 (0)