-->
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.  [ 5 posts ] 
Author Message
 Post subject: Clob Object
PostPosted: Thu Dec 08, 2005 3:39 am 
Newbie

Joined: Fri Jul 15, 2005 12:42 am
Posts: 18
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.0.5

I am making an Auditing module which enters change info for any other entities as CLOB object

/**
* @hibernate.property not-null="true" type="text"
* @return Returns the changeInfo.
*/
public String getChangeInfo() {
return changeInfo;
}


generated mapping is
<property
name="changeInfo"
type="text"
update="true"
insert="true"
column="changeInfo"
not-null="true"
/>

The property changeInfo is of type CLOB in Oracle DB

When the size of the property exceeds approximatly 4000 I get an exception..

org.hibernate.exception.GenericJDBCException: could not insert: [com.transaxiom.axis.common.dto.AuditCLOBDTO]
at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1869)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2200)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:46)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
at com.transaxiom.axslogistics.base.audit.AuditDAO.createAuditLog(AuditDAO.java:108)
at com.transaxiom.axslogistics.base.audit.AuditLogInterceptor.postFlush(AuditLogInterceptor.java:161)
at org.hibernate.event.def.AbstractFlushingEventListener.postFlush(AbstractFlushingEventListener.java:318)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:28)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
at com.transaxiom.axslogistics.base.dao.BasePersistentDAO.persistObject(BasePersistentDAO.java:273)
at com.transaxiom.axslogistics.base.dao.BasePersistentDAO.add(BasePersistentDAO.java:167)
at com.transaxiom.axslogistics.gtoper.service.GenericTransportTOService.addTO(GenericTransportTOService.java:480)
at com.transaxiom.axslogistics.gtoper.TestTO.testAddTO(TestTO.java:219)
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.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)



Caused by: java.sql.SQLException: No more data to read from socket
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:1160)
at oracle.jdbc.ttc7.MAREngine.unmarshalUB1(MAREngine.java:963)
at oracle.jdbc.ttc7.MAREngine.unmarshalSB1(MAREngine.java:893)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:369)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1853)


Can somebody help me out?? :-(


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 08, 2005 8:19 am 
Beginner
Beginner

Joined: Tue Jul 19, 2005 5:08 am
Posts: 26
Location: Germany
please provide the mapping for the object with the CLOB field and the code snippet for your clob handling.


Top
 Profile  
 
 Post subject: Reply Clob Obj
PostPosted: Fri Dec 09, 2005 12:15 am 
Newbie

Joined: Fri Jul 15, 2005 12:42 am
Posts: 18
The mapping is
<property
name="changeInfo"
type="text"
update="true"
insert="true"
column="changeInfo"
not-null="true"
/>


And there is no separate CLOB handling The column "changeInfo" is CLOB in DB and in the Hibernate object its String.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 09, 2005 12:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Yes, this is a known limitation in just about every version of Oracle's JDBC drivers; you cannot insert CLOB data over 4k, only update it.

Supposedly the new 10g drivers finally fix that; you might want to give those a try. Also, there are thirdparty drivers for Oracle which can properly handle that.


Top
 Profile  
 
 Post subject: CLob
PostPosted: Fri Dec 09, 2005 1:56 am 
Newbie

Joined: Fri Jul 15, 2005 12:42 am
Posts: 18
Steve I tried that I set a temporary value as changeInfo and inserted the object.

Then i updated it with the original value but i am getting a new exception here.

The code is
//this is the originalValue
String changeInfo = auditCLOB.getChangeInfo();

auditCLOB.setChangeInfo("temp");
System.out.println("----"+ changeInfo.length());
if (auditDTO.length > 0) {
tempSession.save(auditCLOB);
tempSession.flush(); //Tried commenting this also
System.out.println("1---"+changeInfo.length());
auditCLOB.setChangeInfo(changeInfo);
System.out.println("-C--"+auditCLOB.getChangeInfo());
tempSession.update(auditCLOB);
tempSession.flush();

}

The exception i am getting is this

org.hibernate.exception.GenericJDBCException: could not update: [com.transaxiom.axis.common.dto.AuditCLOBDTO#47368]
at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2000)
at org.hibernate.persister.entity.BasicEntityPersister.updateOrInsert(BasicEntityPersister.java:1909)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2149)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:75)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:137)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
at com.transaxiom.axslogistics.base.audit.AuditDAO.createAuditLog(AuditDAO.java:117)
at com.transaxiom.axslogistics.base.audit.AuditLogInterceptor.postFlush(AuditLogInterceptor.java:161)
at org.hibernate.event.def.AbstractFlushingEventListener.postFlush(AbstractFlushingEventListener.java:318)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:28)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
at com.transaxiom.axslogistics.base.dao.BasePersistentDAO.persistObject(BasePersistentDAO.java:273)
at com.transaxiom.axslogistics.base.dao.BasePersistentDAO.add(BasePersistentDAO.java:167)
at com.transaxiom.axslogistics.gtoper.service.GenericTransportTOService.addTO(GenericTransportTOService.java:446)
at com.transaxiom.axslogistics.gtoper.TestTO.testAddTO(TestTO.java:219)
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.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)


Caused by: java.sql.SQLException: ORA-01407: cannot update ("TRXSMDEV"."CREAUDITLOGCLOB"."CHANGEINFO") to NULL

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:573)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:1982)
... 33 more

This exception happens only if the length of changeInfo is more than 4k
With smaller values both add and update are happening fine.


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

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.