Skip to content

Commit d219878

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 2a3a607 commit d219878

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
@@ -187,13 +187,23 @@ protected String getResultSetIsNullableLabel() {
187187

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

199209
@Override

0 commit comments

Comments
 (0)