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?
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: