Hi,
I'm having a problem updating a parent object which has a one-to-many mapping with a child object. If the partent has no children it updates fine however, if it has one or more children the update fails.
Just to elaborate a little... I have a CallCategory object and a CallType object. The CallCategory contains a Set of CallType objects - it's children - and the CallType object contains a CallCategory object - it's partent. If I try to update a CallCategory object that contains one or more CallType children, the update fails. If it has no CallType children, the update succeeds.
I'm sure this is a pretty fundamental mapping or cascade related problem so hopefully someone will know the answer.
The fulll details are below...
Hibernate version:
3.0 final
Mapping documents:
CallCategory...
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name="com.myApp.common.dto.CallCategory" table="call_category">
<id name="callCategoryId" type="java.lang.Integer">
<column name="CALL_CATEGORY_ID" length="11" not-null="true" sql-type="int" />
<generator class="sequence">
<param name="sequence">CALL_CATEGORY_ID_SEQ</param>
</generator>
</id>
<property name="name" type="java.lang.String">
<column name="NAME" length="100" not-null="true" sql-type="varchar" />
</property>
<set name="setOfCallType">
<key>
<column name="CALL_CATEGORY_ID" length="11" not-null="false" unique="true" />
</key>
<one-to-many class="com.myApp.common.dto.CallType"/>
</set>
</class>
</hibernate-mapping>
CallType...
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name="com.myApp.common.dto.CallType" table="call_type">
<id name="callTypeId" type="java.lang.Integer">
<column name="CALL_TYPE_ID" length="11" not-null="true" sql-type="int" />
<generator class="sequence">
<param name="sequence">CALL_TYPE_ID_SEQ</param>
</generator>
</id>
<many-to-one name="callCategory" class="com.myApp.common.dto.CallCategory">
<column name="CALL_CATEGORY_ID" length="11" not-null="false" unique="true"/>
</many-to-one>
<property name="name" type="java.lang.String">
<column name="NAME" length="100" not-null="true" sql-type="varchar" />
</property>
<property name="description" type="java.lang.String">
<column name="DESCRIPTION" length="100" not-null="true" sql-type="varchar" />
</property>
<set name="setOfRoamingCharge">
<key>
<column name="CALL_TYPE_ID" length="11" not-null="false" unique="true" />
</key>
<one-to-many class="com.myApp.common.dto.RoamingCharge" />
</set>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Note: DataManager is a facade to the Hibernate framework...
Code:
DataManager dm = new DataManager();
CallCategory cc = CallCategoryBuilder.build("CategoryName");
try
{
dm.save(cc);
CallType ct = CallTypeBuilder.build();
ct.setCallCategory(cc);
ct.setName("CallTypeName");
ct.setDescription("CallTypeDescription");
dm.save(ct);
// update the call category name
cc.setName("new name");
dm.update(cc);
System.out.println("Done");
}
catch(Exception e)
{
e.printStackTrace();
}
The update method in DataManager looks like this...
Code:
Session session = sessionFactory.openSession();
Transaction tx = null;
try
{
tx = session.beginTransaction();
session.update(obj);
tx.commit();
}
catch(Exception e)
{
log.error(e.getMessage(), e);
if (tx!=null) tx.rollback();
}
finally
{
session.close();
}
Full stack trace of any exception that occurs:Code:
[DEBUG] [org.hibernate.util.JDBCExceptionReporter] [logExceptions (49)] Could not execute JDBC batch update [update call_type set CALL_CATEGORY_ID=null where CALL_CATEGORY_ID=?]
java.sql.SQLException: ORA-01407: cannot update ("CALL_CHARGES"."CALL_TYPE"."CALL_CATEGORY_ID") to NULL
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:2883)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:172)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:226)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:138)
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:675)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:293)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at com.myApp.dataLayer.DataManager.save(DataManager.java:362)
at com.myApp.dataLayer.DataManager.save(DataManager.java:332)
at com.myApp.DeleteCallCatTest.main(DeleteCallCatTest.java:39)
[WARN ] [org.hibernate.util.JDBCExceptionReporter] [logExceptions (57)] SQL Error: 1407, SQLState: 72000
[ERROR] [org.hibernate.util.JDBCExceptionReporter] [logExceptions (58)] ORA-01407: cannot update ("CALL_CHARGES"."CALL_TYPE"."CALL_CATEGORY_ID") to NULL
[ERROR] [org.hibernate.event.def.AbstractFlushingEventListener] [performExecutions (277)] Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
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.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:179)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:226)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:138)
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:675)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:293)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at com.myApp.dataLayer.DataManager.save(DataManager.java:362)
at com.myApp.dataLayer.DataManager.save(DataManager.java:332)
at com.myApp.DeleteCallCatTest.main(DeleteCallCatTest.java:39)
Caused by: java.sql.SQLException: ORA-01407: cannot update ("CALL_CHARGES"."CALL_TYPE"."CALL_CATEGORY_ID") to NULL
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:2883)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:172)
... 10 more
[ERROR] [13 May 2005 12:02:53,781] [com.myApp.dataLayer.DataManager] [save (367)] Could not execute JDBC batch update
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
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.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:179)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:226)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:138)
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:675)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:293)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at com.myApp.dataLayer.DataManager.save(DataManager.java:362)
at com.myApp.dataLayer.DataManager.save(DataManager.java:332)
at com.myApp.DeleteCallCatTest.main(DeleteCallCatTest.java:39)
Caused by: java.sql.SQLException: ORA-01407: cannot update ("CALL_CHARGES"."CALL_TYPE"."CALL_CATEGORY_ID") to NULL
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:2883)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:172)
... 10 more
Name and version of the database you are using:Oracle 8i
The generated SQL (show_sql=true):update call_category set NAME=? where CALL_CATEGORY_ID=?
update call_type set CALL_CATEGORY_ID=null where CALL_CATEGORY_ID=?
Debug level Hibernate log excerpt:Code:
[DEBUG] [13 May 2005 14:16:51,112] [com.myApp.dataLayer.DataManager] [update (412)] Attempting to update obj
[DEBUG] [org.hibernate.impl.SessionImpl] [<init> (229)] opened session at timestamp: 4571095904714752
[DEBUG] [org.hibernate.transaction.JDBCTransaction] [begin (46)] begin
[DEBUG] [org.hibernate.jdbc.AbstractBatcher] [openConnection (408)] opening JDBC connection
[DEBUG] [org.hibernate.connection.DriverManagerConnectionProvider] [getConnection (93)] total checked-out connections: 0
[DEBUG] [org.hibernate.connection.DriverManagerConnectionProvider] [getConnection (99)] using pooled JDBC connection, pool size: 0
[DEBUG] [org.hibernate.transaction.JDBCTransaction] [begin (50)] current autocommit status: false
[DEBUG] [org.hibernate.event.def.DefaultSaveOrUpdateEventListener] [entityIsDetached (200)] updating detached instance
[DEBUG] [org.hibernate.event.def.DefaultSaveOrUpdateEventListener] [performUpdate (246)] updating [com.myApp.common.dto.CallCategory#113]
[DEBUG] [org.hibernate.event.def.ReattachVisitor] [removeCollection (70)] collection dereferenced while transient [com.myApp.common.dto.CallCategory.setOfCallType#113]
[DEBUG] [org.hibernate.event.def.DefaultSaveOrUpdateEventListener] [performUpdate (293)] updating [com.myApp.common.dto.CallCategory#113]
[DEBUG] [org.hibernate.transaction.JDBCTransaction] [commit (83)] commit
[DEBUG] [org.hibernate.impl.SessionImpl] [managedFlush (292)] automatically flushing session
[DEBUG] [org.hibernate.event.def.AbstractFlushingEventListener] [flushEverythingToExecutions (52)] flushing session
[DEBUG] [org.hibernate.event.def.AbstractFlushingEventListener] [prepareEntityFlushes (102)] processing flush-time cascades
[DEBUG] [org.hibernate.event.def.AbstractFlushingEventListener] [prepareCollectionFlushes (150)] dirty checking collections
[DEBUG] [org.hibernate.event.def.AbstractFlushingEventListener] [flushEntities (167)] Flushing entities and processing referenced collections
[DEBUG] [org.hibernate.event.def.DefaultFlushEntityEventListener] [onFlushEntity (121)] Updating entity: [com.myApp.common.dto.CallCategory#113]
[DEBUG] [org.hibernate.event.def.AbstractFlushingEventListener] [flushCollections (203)] Processing unreferenced collections
[DEBUG] [org.hibernate.event.def.AbstractFlushingEventListener] [flushCollections (217)] Scheduling collection removes/(re)creates/updates
[DEBUG] [org.hibernate.event.def.AbstractFlushingEventListener] [flushEverythingToExecutions (79)] Flushed: 0 insertions, 1 updates, 0 deletions to 1 objects
[DEBUG] [org.hibernate.event.def.AbstractFlushingEventListener] [flushEverythingToExecutions (85)] Flushed: 0 (re)creations, 0 updates, 1 removals to 0 collections
[DEBUG] [org.hibernate.pretty.Printer] [toString (83)] listing entities:
[DEBUG] [org.hibernate.pretty.Printer] [toString (90)] com.myApp.common.dto.CallCategory{callCategoryId=113, setOfCallType=null, name=new name}
[DEBUG] [org.hibernate.event.def.AbstractFlushingEventListener] [performExecutions (267)] executing flush
[DEBUG] [org.hibernate.persister.entity.BasicEntityPersister] [update (1953)] Updating entity: [com.myApp.common.dto.CallCategory#113]
[DEBUG] [org.hibernate.jdbc.AbstractBatcher] [logOpenPreparedStatement (276)] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
[DEBUG] [org.hibernate.jdbc.AbstractBatcher] [log (310)] update call_category set NAME=? where CALL_CATEGORY_ID=?
[DEBUG] [org.hibernate.jdbc.AbstractBatcher] [getPreparedStatement (364)] preparing statement
[DEBUG] [org.hibernate.persister.entity.BasicEntityPersister] [dehydrate (1627)] Dehydrating entity: [com.myApp.common.dto.CallCategory#113]
[DEBUG] [org.hibernate.type.NullableType] [nullSafeSet (59)] binding 'new name' to parameter: 1
[DEBUG] [org.hibernate.type.NullableType] [nullSafeSet (59)] binding '113' to parameter: 2
[DEBUG] [org.hibernate.jdbc.BatchingBatcher] [addToBatch (27)] Adding to batch
[DEBUG] [org.hibernate.jdbc.BatchingBatcher] [doExecuteBatch (54)] Executing batch size: 1
[DEBUG] [org.hibernate.jdbc.BatchingBatcher] [checkRowCount (80)] success of batch update unknown: 0
[DEBUG] [org.hibernate.jdbc.AbstractBatcher] [logClosePreparedStatement (284)] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
[DEBUG] [org.hibernate.jdbc.AbstractBatcher] [closePreparedStatement (392)] closing statement
[DEBUG] [org.hibernate.persister.collection.AbstractCollectionPersister] [remove (794)] Deleting collection: [com.myApp.common.dto.CallCategory.setOfCallType#113]
[DEBUG] [org.hibernate.jdbc.AbstractBatcher] [logOpenPreparedStatement (276)] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
[DEBUG] [org.hibernate.jdbc.AbstractBatcher] [log (310)] update call_type set CALL_CATEGORY_ID=null where CALL_CATEGORY_ID=?
[DEBUG] [org.hibernate.jdbc.AbstractBatcher] [getPreparedStatement (364)] preparing statement
[DEBUG] [org.hibernate.type.NullableType] [nullSafeSet (59)] binding '113' to parameter: 1
[DEBUG] [org.hibernate.jdbc.BatchingBatcher] [addToBatch (27)] Adding to batch
[DEBUG] [org.hibernate.persister.collection.AbstractCollectionPersister] [remove (821)] done deleting collection
[DEBUG] [org.hibernate.jdbc.BatchingBatcher] [doExecuteBatch (54)] Executing batch size: 1
[DEBUG] [org.hibernate.jdbc.AbstractBatcher] [logClosePreparedStatement (284)] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
[DEBUG] [org.hibernate.jdbc.AbstractBatcher] [closePreparedStatement (392)] closing statement
[DEBUG] [org.hibernate.util.JDBCExceptionReporter] [logExceptions (49)] Could not execute JDBC batch update [update call_type set CALL_CATEGORY_ID=null where CALL_CATEGORY_ID=?]
java.sql.SQLException: ORA-01407: cannot update ("CALL_CHARGES"."CALL_TYPE"."CALL_CATEGORY_ID") to NULL
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:2883)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:172)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:226)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:138)
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:675)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:293)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at com.myApp.dataLayer.DataManager.update(DataManager.java:430)
at com.myApp.DeleteCallCatTest.main(DeleteCallCatTest.java:46)
[WARN ] [org.hibernate.util.JDBCExceptionReporter] [logExceptions (57)] SQL Error: 1407, SQLState: 72000
[ERROR] [org.hibernate.util.JDBCExceptionReporter] [logExceptions (58)] ORA-01407: cannot update ("CALL_CHARGES"."CALL_TYPE"."CALL_CATEGORY_ID") to NULL
[ERROR] [org.hibernate.event.def.AbstractFlushingEventListener] [performExecutions (277)] Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
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.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:179)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:226)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:138)
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:675)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:293)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at com.myApp.dataLayer.DataManager.update(DataManager.java:430)
at com.myApp.DeleteCallCatTest.main(DeleteCallCatTest.java:46)
Caused by: java.sql.SQLException: ORA-01407: cannot update ("CALL_CHARGES"."CALL_TYPE"."CALL_CATEGORY_ID") to NULL
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:2883)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:172)
... 9 more
[ERROR] [13 May 2005 14:16:51,221] [com.myApp.dataLayer.DataManager] [update (435)] Could not execute JDBC batch update
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
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.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:179)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:226)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:138)
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:675)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:293)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at com.myApp.dataLayer.DataManager.update(DataManager.java:430)
at com.myApp.DeleteCallCatTest.main(DeleteCallCatTest.java:46)
Caused by: java.sql.SQLException: ORA-01407: cannot update ("CALL_CHARGES"."CALL_TYPE"."CALL_CATEGORY_ID") to NULL
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:2883)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:172)
... 9 more
[DEBUG] [13 May 2005 14:16:51,221] [com.myApp.exception.ExceptionManager] [getExceptionMessage (86)] Looking up exception message for key: 1014
[DEBUG] [13 May 2005 14:16:51,221] [com.myApp.common.util.PropertiesManager] [getPropertyReader (64)] Looking up PropertyReader for properties file: com/o2/roamingCharges/exception/exceptions.properties
[DEBUG] [13 May 2005 14:16:51,221] [com.myApp.common.util.PropertiesManager] [getPropertyReader (74)] No PropertyReader object exists for that properties file yet
[DEBUG] [13 May 2005 14:16:51,221] [com.myApp.common.util.PropertiesManager] [createNewPropertyReader (113)] Creating new PropertyReader for properties file: com/o2/roamingCharges/exception/exceptions.properties
[DEBUG] [13 May 2005 14:16:51,237] [com.myApp.common.util.PropertyReader] [<init> (42)] Initialising PropertReader for file: com/o2/roamingCharges/exception/exceptions.properties
[DEBUG] [13 May 2005 14:16:51,237] [com.myApp.common.util.PropertyReader] [loadProps (62)] Attempting to load properties file: com/o2/roamingCharges/exception/exceptions.properties with ClassLoader...
[DEBUG] [13 May 2005 14:16:51,237] [com.myApp.common.util.PropertyReader] [loadProps (65)] Succesfully loaded properties file with ClassLoader
[DEBUG] [13 May 2005 14:16:51,253] [com.myApp.common.util.PropertiesManager] [createNewPropertyReader (116)] Adding PropertyReader to hashtable
[DEBUG] [13 May 2005 14:16:51,253] [com.myApp.common.util.PropertyReader] [getProperty (130)] Retrieving value for property: 1014 from file com/o2/roamingCharges/exception/exceptions.properties
[DEBUG] [13 May 2005 14:16:51,253] [com.myApp.common.util.PropertyReader] [getProperty (135)] 1014 = [Error: 1005] - Failed to update obj - rolling back.
[DEBUG] [13 May 2005 14:16:51,253] [com.myApp.exception.ExceptionManager] [getExceptionMessage (103)] Message for key: 1014 - [Error: 1005] - Failed to update obj - rolling back.
[WARN ] [13 May 2005 14:16:51,253] [com.myApp.dataLayer.DataManager] [update (450)] [Error: 1005] - Failed to update obj - rolling back.
[DEBUG] [org.hibernate.transaction.JDBCTransaction] [rollback (124)] rollback
[DEBUG] [org.hibernate.jdbc.JDBCContext] [beforeTransactionCompletion (208)] before transaction completion
[DEBUG] [org.hibernate.impl.SessionImpl] [beforeTransactionCompletion (337)] before transaction completion
[DEBUG] [org.hibernate.transaction.JDBCTransaction] [rollback (135)] rolled back JDBC Connection
[DEBUG] [org.hibernate.jdbc.JDBCContext] [afterTransactionCompletion (213)] after transaction completion
[DEBUG] [org.hibernate.impl.SessionImpl] [afterTransactionCompletion (353)] after transaction completion
[DEBUG] [org.hibernate.impl.SessionImpl] [close (246)] closing session
[DEBUG] [org.hibernate.jdbc.AbstractBatcher] [closeConnection (423)] closing JDBC connection (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)
[DEBUG] [org.hibernate.connection.DriverManagerConnectionProvider] [closeConnection (129)] returning connection to pool, pool size: 1
[DEBUG] [org.hibernate.jdbc.JDBCContext] [afterTransactionCompletion (213)] after transaction completion
[DEBUG] [org.hibernate.impl.SessionImpl] [afterTransactionCompletion (353)] after transaction completion
com.myApp.exception.DataLayerException: [Error: 1005] - Failed to update obj - rolling back.
at com.myApp.dataLayer.DataManager.update(DataManager.java:452)
at com.myApp.DeleteCallCatTest.main(DeleteCallCatTest.java:46)
If anyone can shed some light on what I'm missing here I'd really appreciate it.
Cheers :)