I'm using Hibernate Tools 3.2.1.GA with Spring version 3.0.2. I'm tying to insert data into Oracle (10g) database field of type clob
as follows.
Clob c=Hibernate.createClob(request.getParameter("someTextFieldValueOnJSPPage");
pojoObj.setSomeClobProperty(c);
it works just fine but when I attempt to insert a stream of data using a CKEditor, demo on my JSP page (the CKEditor simply renders an HTML <textarea></textarea>
element) that may involve formatted text as well as images, flash etc, it throws the following exception.
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.hibernate.exception.GenericJDBCException: could not update: [model.Cms#1]
org.hibernate.exception.GenericJDBCException: could not update: [model.Cms#1]
java.sql.SQLException: operation not allowed: streams type cannot be used in batching
How to resolve that exception? Is this the Oracle driver problem or something else? I'm using ojdbc14.jar
, Oracle JDBC Driver version - 9.0.2.0.0
.
UPDATE:
One of the entities that uses the Clob
type is
public class Cms implements java.io.Serializable
{
private BigDecimal cmsId;
private Clob aboutUs; //I'm currently dealing with this property.
private Clob contactUs;
private Clob privacyPolicy;
private Clob returnPolicy;
private Clob shippingPolicy;
private Clob termsOfUse;
private Clob exchangeLinks;
private Clob disclaimer;
private Clob aboutProducts;
private Clob purchasingConditions;
private Clob faq;
//Parameterized constructor(s) along with the default one as and when needed.
//Getters and setters.
}
In my Spring controller class, I'm using the following code to perform insertion on the Clob
type in Oracle.
Cms c=new Cms();
c.setCmsId(new BigDecimal(0));
c.setAboutUs(Hibernate.createClob(request.getParameter("txtAboutUs")));
session.save(c);
session.flush();
session.getTransaction().commit();
model.put("status", "1");
model.put("msg","Insertion done successfully.");
//setParameter(cb);
Where model
is simply a Map model
, a formal parameter of the submit()
method in the Spring controller class which is invoked when a submit button is clicked on the JSP page.
I'm retrieving data using the following simple method in the Spring controller class
private void getData(Map model)
{
Session session=NewHibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
List<Cms>list=session.createQuery("from Cms order by cmsId desc").list();
model.put("list", list);
session.flush();
session.getTransaction().commit();
}
Tried to do as mentioned here but to no avail (I'm facing the same exceptions as specified in that question).