I cannot update CLOB fields that are longer than 4000 characters.
When saving a record with a CLOB field, mapped as @Lob, if the java string property is longer than 4000 characters, a null is inserted. If <4000 characters, it updates correctly.
Is this a limitation with hibernate or Oracle, or am I doing something wrong?
Hibernate version: 3.1
Mapping documents:
@Lob
@NotNull
@Column(name="session_data")
public String getSessionData() {
return sessionData;
}
public void setSessionData(String sessionData) {
this.sessionData = sessionData;
}
Code between sessionFactory.openSession() and session.close():
// dao is my data access object
// sesInfo1 is an instance of the class that has the mapped property, sessionData
String oldData = sesInfo1.getSessionData();
sesInfo1.setSessionData("You should not see me");
dao.save(sesInfo1);
dao.commitTransaction();
sesInfo1.setSessionData(oldData);
dao.saveOrUpdate(sesInfo1);
dao.commitTransaction();
dao.close();
Full stack trace of any exception that occurs:
No stack trace
Name and version of the database you are using:
Database 10g Express Edition Release 10.2.0.1.0
The generated SQL (show_sql=true):
Hibernate: select session_info_seq.nextval from dual
Hibernate: insert into session_info (session_code, lastmodified, external_identifier, session_data, session_id) values (?, ?, ?, ?, ?)
Hibernate: update session_info set session_code=?, lastmodified=?, external_identifier=?, session_data=? where session_id=? and lastmodified=?
Hibernate: select * from ( select this_.session_id as session1_24_0_, this_.session_code as session2_24_0_, this_.lastmodified as lastmodi3_24_0_, this_.external_identifier as external4_24_0_, this_.session_data as session5_24_0_ from session_info this_ where this_.external_identifier=? ) where rownum <= ?
_________________ Reuben Fisher
Principal Software Engineer, Houghton-Mifflin
|