Question

I'm working on a project in which I have a class with this attribute:

@Column(name="XMLDATA", columnDefinition="CLOB NOT NULL") @Lob @Basic(fetch=FetchType.LAZY)
@Getter @Setter private String _xmlData;

In the database, the column type for that attribute is CLOB.

I'm running the application on weblogic 11gR1 (10.3.5), using Oracle database (11gR2), JPA and eclipselink as JPA Provider. The problem I have is that everytime I save a registry on the database, the clob is the only field that is not saved.

But if I don't put the @lob annotation, then it works fine.

In the logs, I can see that first it uses an "insert" sentence to insert all the data except for the clob, and then it uses a "select for update" sentence to insert the clob data, I don't know if this may be part of the problem.

Thank you.

Was it helpful?

Solution 2

I've searched a lot for this answer, until I realized that if you are using EclipseLink, at least 2.5.2 version, you don't have to use "@Column(name="XMLDATA", columnDefinition="CLOB NOT NULL") @Lob @Basic(fetch=FetchType.LAZY)". Just do this:

@Column(name = "XML_DATA")
private String _xmlData;

EclipseLink will know how to handle the CLOB column.

OTHER TIPS

For the proper management of the blobs (JPA + Oracle) you must specify the following properties of eclipselink :

property name="eclipselink.target-database" value= "org.eclipse.persistence.platform.database.oracle.Oracle11Platform"

It seems that JPA sometimes cannot detect the correct version of Oracle Database platform

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top