[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5659) Problem using Hibernate3.6.0.Final with CLOB field in Oracle.

David Linsey (JIRA) noreply at atlassian.com
Fri Jan 14 14:36:05 EST 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=39637#action_39637 ] 

David Linsey commented on HHH-5659:
-----------------------------------

Thanks, after your guidance and some troubleshooting, I figured out a combination that works.  First, in previous tests I had set the use_streams_for_binary in the hibernate.cfg.xml which isn't supported as it is a global property.  Once I set it in hibernate.properties, and changed the type in the mapping file to materialized_clob, I got a class cast exception.  This turned out to be because my POJO defined the columns a java.sql.Clob, which is what it was with old Hibernate (I already switched my code to use LobHelper to write the data).  Switching this to a plain old String fixed it.  Seems using the streams parameter the data type needs to be a String and it handles the conversion to Clob itself inside Hibernate.  The fact the Oracle9Dialect already sets this streams parmeter to true but it isn't picked also is confusing, but seems Steve is aware of that and I found a rejected bug from 2004 on it too (HB-646).

> Problem using Hibernate3.6.0.Final with CLOB field in Oracle.
> -------------------------------------------------------------
>
>                 Key: HHH-5659
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5659
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.6.0
>         Environment: Hibernate 3.6.0.Final, Database Oracle10G on Linux X64, and JPA
>            Reporter: Samuel Rettore
>            Priority: Minor
>             Fix For: 3.6.1, 4.0.0.Alpha1
>
>         Attachments: createClob_Deprecated.png, Hibernate_createClob_Deprecated.png, LobHelper_Interface.png, Srhlog.java
>
>
> When migrating my project that works well with Hibernate 3.5.6 End-to 3.6.0.Final the Clob field displays the following error 
> |java.lang.ClassCastException: $Proxy1119 cannot be cast to oracle.sql.CLOB
>         at oracle.jdbc.driver.OraclePreparedStatement.setClob(OraclePreparedStatement.java:7021)
>         at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$1.doBind(ClobTypeDescriptor.java:60)
>         at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:89)
>         at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:282)
>         at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:277)
>         at org.hibernate.type.AbstractSingleColumnStandardBasicType.nullSafeSet(AbstractSingleColumnStandardBasicType.java:85)
>         at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2166)
>         at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2412)
>         at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2856)
>         at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)
>         at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)
>         at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265)
>         at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184)
>         at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
>         at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
>         at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
>         at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:795)
>         at com.sun.enterprise.container.common.impl.EntityManagerWrapper.flush(EntityManagerWrapper.java:407)
> ---
> This error appears only with CLOB field.
> to get more information at their disposal.
> Thanks
> Rettore.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list