Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

TopLink JPA doesn't persist Clob field when useStringBinding

459427Feb 8 2007 — edited Feb 12 2007
I'm using Toplink JPA on a JSF application deploying on Tomcat.
Everything works fine except the table with Clob field.
When insert data with size larger than 4KB, the error will occur.
I did some searching and I fixed this by using SessionCustomizer.

In my persistence.xml I put this
<property name="toplink.session.customizer" value="com.my.sessions.MySessionCustomizer"/>

and MySessionCustomizer is like this

public class MySessionCustomizer implements SessionCustomizer {

public void customize(Session session) throws Exception {
DatabaseLogin login = session.getLogin();
login.useStringBinding();
login.setShouldBindAllParameters(false);
login.dontCacheAllStatements();
}
}

Things seem to work fine now but I found that Toplink does not persist the field that useStringBinding in database (Oracle 9i)

eg. when I update an object into a table which has 1 clob field and some other field like VARCHAR2, all the data in non-clob fields are stored perfectly in Oracle but the data in Clob field just gone blank. It just gone blank in the database but in my application, it's still there. I mean as long as my session is still alive, everything seems to work fine from the application side. But when I start a new session, the data in the Clob is lost because it's not in the database.

Why is this happening? Do I need to do anything extra when useStringBinding?
It seems to me that the field with StringBinding just don't get into the database.
Could somebody help me with this?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 12 2007
Added on Feb 8 2007
2 comments
1,011 views