Hi,
I am in a very terrible situation. I am trying to persist large strings into a table column with type CLOB. My database is in Oracle. I am using JPA and noticed that its fine with small strings, but crashes badly with the exception "streams type cannot be used in batching" ; if the strings are of size around 700 to 1000 characters. It would be great if anyone can help me regarding this issues. The following is my sample code and exception
Entity Class
@Entity public class Report implements Serializable{ private int id; private String reportContent; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="REPORT_ID") public int getId () { return id; } public void setId (int reportID) { this.id = reportID; } @Lob @Basic(fetch=FetchType.LAZY) public String getReportContent () { return reportContent; } public void setReportContent (String reportContent) { this.reportContent = reportContent; } }
2007-06-26 09:31:45,173 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 17090, SQLState: null 2007-06-26 09:31:45,173 ERROR [org.hibernate.util.JDBCExceptionReporter] operation not allowed: streams type cannot be used in batching 2007-06-26 09:31:45,173 ERROR [org.hibernate.event.def.AbstractFlushingEventListener] Could not synchronize database state with session org.hibernate.exception.GenericJDBCException: could not update: [au.com.thedistillery.validate.persistence.reporting.ReportContent#2] at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2425) at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2307) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2607)
hi.....i figured out the problem....i was using an old JDBC driver for oracle....it worked successfully once i downloaded the latest Oracle JDBC driver (ojdbc14.jar) from the oracle web site....
Thanks