I found something very peculiar.
Here is the mapping of one of the objects.
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="de.amarant.ag.model.master.MDataColumn" table="QASG_DATA_COLUMN">
<id name="id" type="int" unsaved-value="0">
<generator class="increment"/>
</id>
<property name="name"/>
<property name="type"/>
<property name="data">
<column name="data" sql-type="LONG RAW"/>
</property>
<many-to-one name="dataSetRef" column="data_set_id" not-null="true"/>
</class>
</hibernate-mapping>
The property "data" is a blob created using Hibernate.createBlob() method. I located the real problem when trying to insert. Here is the method of MDataColumn that creates the blob
Code:
public void writeData() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
GZIPOutputStream gzipOS = new GZIPOutputStream(baos);
if (type == TYPE_FLOAT) {
writeFloatData(gzipOS);
} else {
writeStringData(gzipOS);
}
// if (type == TYPE_FLOAT) {
// writeFloatData(baos);
// } else {
// writeStringData(baos);
// }
data = Hibernate.createBlob(baos.toByteArray());
}
If I try to use the GZIPOutputStream then the program cannot insert the data on the database, otherwise everything works fine. I know that the GZIPOutputStream is working correctly 'cause I tried earlier with MySql and everything worked correctly. The error I get when using Oracle and the GZIPOutputStream is:
Code:
WARN - SQL Error: 3106, SQLState: 63000
ERROR - ORA-03106: fatal two-task communication protocol error
WARN - SQL Error: 3106, SQLState: 63000
ERROR - ORA-03106: fatal two-task communication protocol error
WARN - SQL Error: 3106, SQLState: 63000
ERROR - ORA-03106: fatal two-task communication protocol error
WARN - SQL Error: 3106, SQLState: 63000
ERROR - ORA-03106: fatal two-task communication protocol error
ERROR - could not insert: [de.amarant.ag.model.master.MDataColumn#15]
java.sql.BatchUpdateException: ORA-03106: fatal two-task communication protocol error
at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:367)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:8739)
at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
at net.sf.hibernate.impl.BatchingBatcher.addToBatch(BatchingBatcher.java:34)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:468)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:442)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2414)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2367)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2236)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at de.amarant.ag.test.OracleError.main(OracleError.java:137)
Exception in thread "main" net.sf.hibernate.JDBCException: could not insert: [de.amarant.ag.model.master.MDataColumn#15]
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:478)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:442)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2414)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2367)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2236)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at de.amarant.ag.test.OracleError.main(OracleError.java:137)
Caused by: java.sql.BatchUpdateException: ORA-03106: fatal two-task communication protocol error
at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:367)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:8739)
at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
at net.sf.hibernate.impl.BatchingBatcher.addToBatch(BatchingBatcher.java:34)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:468)
... 7 more
ERROR - Could not synchronize database state with session
net.sf.hibernate.JDBCException: could not insert: [de.amarant.ag.model.master.MDataColumn#15]
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:478)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:442)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2414)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2367)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2236)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at de.amarant.ag.test.OracleError.main(OracleError.java:137)
Caused by: java.sql.BatchUpdateException: ORA-03106: fatal two-task communication protocol error
at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:367)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:8739)
at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
at net.sf.hibernate.impl.BatchingBatcher.addToBatch(BatchingBatcher.java:34)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:468)
... 7 more
The sql created by Hibernate:
Hibernate: insert into QASG_DATA_SET (name, id) values (?, ?)
Hibernate: insert into QASG_DATA_COLUMN (name, type, data, data_set_id, id) values (?, ?, ?, ?, ?)
Thanx again in advanced