Skip to content

Commit

Permalink
[#1532] fix getBoolean() for Oracle
Browse files Browse the repository at this point in the history
  • Loading branch information
blafond committed Apr 4, 2023
1 parent 1c37544 commit a07a9fc
Showing 1 changed file with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,23 @@ public String getString(int columnIndex) {

@Override
public boolean getBoolean(int columnIndex) {
Boolean bool = row.getBoolean( columnIndex - 1 );
wasNull = bool == null;
return !wasNull && bool;
try {
Boolean bool = row.getBoolean( columnIndex - 1 );
wasNull = bool == null;
return !wasNull && bool;
}
catch (ClassCastException cce) {
// Oracle doesn't support an actual boolean/Boolean datatype.
// Oracle8iDialect in ORM registers the BOOLEAN type as a 'number( 1, 0 )'
// so we need to convert the int to a boolean
try {
return getInt( columnIndex ) != 0;
}
catch (Exception e) {
// ignore second exception and throw first cce
throw cce;
}
}
}

@Override
Expand Down

0 comments on commit a07a9fc

Please sign in to comment.