views:

622

answers:

2

Hi, i have a java class persisting a string (>4k) into a database table into a CLOB field. If the string is less than 4k then it works.

I have the field annotated using @Lob and initially I was getting an exception due to batching not supported for streams so I made the batch size 0 in the Hibernate config which is giving the exception:

Caused by: java.sql.SQLException: ORA-01460: unimplemented or unreasonable conversion requested

  at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
  at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
  at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:582)
  at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1986)
  at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1144)
  at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2152)
  at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:2035)
  at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2876)
  at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:609)
  at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:23)
  at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2062)
  ... 36 more

I only get this issue when using the code from Grails. When I use the same code from a pure Java application then I don't get the issue. Both applications have the same hibernate config (except I need to set the batch size to 0 in Grails). Is the issue the difference in the Hibernate versions which is 3.2.6ga in Grails as far as I can see and 3.2.5ga for the java application. The Oracle driver is the same in both cases.

Any answers welcome.

A: 

Try with annotating the field with @Column(length = Integer.MAX_VALUE). This hibernate bug report mentions it helped in Derby.

Wayne Young
+2  A: 

Maybe this post helps you.

NetSide