Hi everybody.
I've ran into a strange problem. I have simple relation many-to-one between Item and Claim:
Code:
<class dynamic-update="true" name="Rmtitem" table="RmtItem">
<many-to-one class="Rmtclaim" name="rircintn" column="rircintn"/>
...
</class>
When I try to execute:
Code:
Object claim = session.load(Rmtclaim.class, Integer.valueOf(375208));
Object item = session.load(Rmtitem.class, Integer.valueOf(325122));
session.delete(claim);
session.delete(item);
session.flush();
Exception is trown:
Code:
Hibernate: update RmtItem set rircintn=? where riintn=?
Exception in thread "main" org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
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.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:142)
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 test.Tester.main(Tester.java:57)
Caused by: java.sql.BatchUpdateException: ORA-01407: cannot update ("ARE_RQ73"."RMTITEM"."RIRCINTN") to NULL
at oracle.jdbc.dbaccess.DBError.throwBatchUpdateException(DBError.java:459)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:4337)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
... 6 more
Java Result: 1
Why hibernate attempts to update record to be deleted?
If order is
Code:
session.delete(item);
session.delete(claim);
then test passes.