[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5659?page=c...
]
Steve Ebersole commented on HHH-5659:
-------------------------------------
I *think* there are actually a few discussions going on here.
First, I would have to assume that Oracle's support of LOBs is still a bit lacking in
their JDBC driver based on this exception. It would appear that you can only bind
Oracle-specific LOB classes ({{oracle.sql.CLOB}} here) to statements, as opposed to any
impl of matching LOB interface. So for this to work you would need to leverage
"contextual LOB creation" to make sure that {{java.sql.Connection#createClob}}
is called here. {{Hibernate#createClob}} does not, because it does not have access to the
{{Connection}}. You'd instead have to utilize {{LobHelper}} as outlined in the
deprecation notes: {{session.getLobHelper().createClob(...)}}. That *should* fix the
reported issue.
As for the discussion of {{StringClobType}} versus {{MaterializedClobType}},
{{StringClobType}} always uses (and has always used) binary streams for binding.
{{MaterializedClobType}} will only use binary streams for binding if
{{use_streams_for_binary}} is enabled, otherwise it will attempt to directly bind the CLOB
value. That is totally reasonable IMO.
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
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira