Replace usage of deprecated "long" data type for large strings with "clob" in OracleDialect

Description

As of Hibernate version 5.4.1.Final , Strings longer than 4000 characters are mapped to "long" data type when using the latest Oracle dialects. That is defined in org.hibernate.dialect.Oracle9iDialect.registerCharacterTypeMappings():87.

According to Oracle, the "long" data type is deprecated and should be replaced with "clob" (https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Data-Types.html#GUID-F6309DF8-162F-48A4-9454-FEE59EC6644F) , since at least version 8.0.4 (https://docs.oracle.com/cd/A58617_01/server.804/a58241/ch5.htm#419582).

I would like my application to use "Text" columns in both Postgres and Oracle. The way I see it this should be translated to "text" type in Postgres, and for Oracle depending on the size to either a "varchar" or a "clob".

As a "workaround" I've been using a custom dialect to replace usages of "long" with "clob". I haven't noticed any strange side-effects so far using Oracle 12.2. Here's the code:

Is there any chance that we can use "clob" like this in (one of) the standard dialects? Maybe it's not a good idea to change older dialects, but perhaps the latest? I understand this has been discussed before multiple times (I'll link all relevant issues I could find), but I was wondering if there are any plans in place to address this?

Environment

None

Activity

Show:
Miguel Diogo
March 26, 2019, 4:51 PM

Similar issues rejected: . But these seem to concern Oracle10 dialects and earlier. Maybe there was some issue with the drivers back then too?
A similar suggestion came up here: HHH-6066, but ultimately only Postgres was fixed it seems.

This open ticket is likely caused by using "long" as default for lengthy strings:

Assignee

Unassigned

Reporter

Miguel Diogo

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure