I am trying to get an entity to work with Oracle (11.2) and PostgreSQL (9.4) in a Spring Boot (1.4.4) application.
My entity contains a long text field (over 4000 characters). The corresponding data type in Oracle is CLOB, and the corresponding type in PostgreSQL is TEXT.
I can make it work with PostgreSQL
@Column(name = "LONG_TEXT", columnDefinition="TEXT")
private String longText;
However, it will not work with Oracle during the sleep mode verification stage, since CLOB requires @Lob annotation.
The following code works with Oracle
@Lob
@Column(name = "LONG_TEXT")
private String longText;
However, this time this fails when reading from PostgreSQL with the following exception:
PSQLException: large objects cannot be used in auto-commit mode
. , @Transactional .
.