I recently updated an application to SpringBoot 3.2 with Hibernate 6 and encountered and issue selecting data by using repository.findById() out of an Oracle database with column type LONG RAW containing a hex string.
Caused by: oracle.jdbc.OracleDatabaseException: ORA-00997: illegal use of LONG datatype
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:637)
… 135 common frames omitted
I cannot change the column type, because I only have read access. It is not possible to create a view, because to_lob() can only be used in insert statements.
I tried using prefer_long_raw flag, but with no success, the error remained.
Entity
@Lob
@Column(name = "DATA", nullable = true)
private byte[] data;
application.yml
spring:
jpa:
properties:
hibernate:
dialect: org.hibernate.dialect.OracleDialect
dialect.oracle.prefer_long_raw: true
ChatGPT suggested to use native queries, but the entity has some relationships and different data types, so it would be a little bit complex.
Any other suggestions?