Skip to content

Commit d76b7ef

Browse files
committed
[#2738] Return the correct column data type for Oracle
The Oracle schema extractor is only partially implemented, returning data type 0 for most of the SQL column types. This causes the schema validation to fail even if the columns on the table are valid.
1 parent 0df8c10 commit d76b7ef

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

hibernate-reactive-core/src/main/java/org/hibernate/reactive/provider/service/OracleSqlReactiveInformationExtractorImpl.java

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,22 @@ protected String getResultSetIsNullableLabel() {
190190

191191
@Override
192192
protected int dataTypeCode(String typeName) {
193-
// ORACLE only supports "float" sql type for double precision
194-
// so return code for double for both double and float column types
195-
if ( typeName.equalsIgnoreCase( "float" ) ||
196-
typeName.toLowerCase().startsWith( "double" ) ) {
197-
return Types.DOUBLE;
198-
}
199-
return super.dataTypeCode( typeName );
193+
return switch ( typeName.toLowerCase() ) {
194+
// ORACLE only supports "float" sql type for double precision
195+
// so return code for double for both double and float column types
196+
case "float", "double", "binary_double" -> Types.DOUBLE;
197+
case "timestamp" -> Types.TIMESTAMP;
198+
case "timestamp with time zone", "timestamp with local time zone" -> Types.TIMESTAMP_WITH_TIMEZONE;
199+
case "clob" -> Types.CLOB;
200+
case "blob" -> Types.BLOB;
201+
case "raw" -> Types.VARBINARY;
202+
case "long raw" -> Types.LONGVARBINARY;
203+
case "ref cursor" -> Types.REF_CURSOR;
204+
case "number" -> Types.NUMERIC;
205+
case "date" -> Types.DATE;
206+
case "nvarchar2" -> Types.NVARCHAR;
207+
case "varchar2" -> Types.VARCHAR;
208+
default -> 0;
209+
};
200210
}
201211
}

0 commit comments

Comments
 (0)