-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Issue with handling CLOB in Hibernate 3.2 with DB2 8.1
PostPosted: Mon Jun 04, 2007 10:27 am 
Newbie

Joined: Mon Jun 04, 2007 10:09 am
Posts: 1
Hi,

Am using hibernate-3.2.4.sp1 & Database DB2 8.1. Having trouble inserting clob data into DB [able to read data successfully though]. Below is the SQL generated by Hibernate & Exception

Hibernate: select trvwxmldoc0_.XML_DOC_ID as XML1_6_0_, trvwxmldoc0_.DATA_CLOB as DATA2_6_0_ from CPC.TRVW_XML_DOC trvwxmldoc0_ where trvwxmldoc0_.XML_DOC_ID=?

Clob:: org.hibernate.lob.SerializableClob@da90c -- actual clob data

Hibernate: insert into CPC.TRVW_XML_DOC (DATA_CLOB, XML_DOC_ID) values (?, ?)

2007-06-04 10:18:56,625 WARN util.JDBCExceptionReporter - SQL Error: -423, SQLState: 0F001
2007-06-04 10:18:56,625 ERROR util.JDBCExceptionReporter - [IBM][CLI Driver][DB2/NT] SQL0423N Locator variable "1" does not currently represent any value. SQLSTATE=0F001

2007-06-04 10:18:56,625 ERROR .AbstractFlushingEventListener - Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: could not insert: [com.insure3.db.vo.TrvwXmlDoc]
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.insert(AbstractEntityPersister.java:2267)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2660)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:56)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at com.insure3.db.dao.CustomDAO.persistInstance(CustomDAO.java:281)
at test.com.insure3.db.dao.CustomDAOTest.testPersistInstance(CustomDAOTest.java:133)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0423N Locator variable "1" does not currently represent any value. SQLSTATE=0F001

at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java:275)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java:217)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(SQLExceptionGenerator.java:449)
at COM.ibm.db2.jdbc.app.DB2Clob.length(DB2Clob.java:246)
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.setClob(DB2PreparedStatement.java:5391)
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.setClob(DB2PreparedStatement.java:5375)
at org.hibernate.type.ClobType.set(ClobType.java:50)
at org.hibernate.type.ClobType.nullSafeSet(ClobType.java:118)
at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:1997)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2243)
... 30 more
2007-06-04 10:18:56,640 ERROR common.util - Caller :persist failed
Message :persist failed



I tried creating user type [StringClobType], but didn't work. Below is the mapping

<hibernate-mapping package="com.insure3.db.vo" auto-import="true" >
<class name="TrvwXmlDoc" table="TRVW_XML_DOC" schema="CPC">
<id name="xmlDocId" type="string">
<column name="XML_DOC_ID" length="42" />
<generator class="assigned" />
</id>
<!-- property name="dataClob" type="com.insure3.db.util.StringClobType"-->
<property name="dataClob" type="clob">
<column name="DATA_CLOB" />
</property>



I am in immediate need for a solution to this. Immediated responses would be much appreciated.

Thanks,
Chetan


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.