I am using hibernate with DB2/AS400.
When I set any isoltion level other than '0' in the hibernate.cfg.xml and try to insert/update data in the table on DB2/AS400, The Exception '' could not update :" occurs.
Update is succesful for isolation level 0. Please guide how this can be solved.
Following is the error stack trace.
could not update: [com.test.dto.TestDTO#10]
org.hibernate.exception.GenericJDBCException: could not update: [com.test.dto.TestDTO#10]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2221)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2117)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2373)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:84)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:227)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:905)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:345)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at com.test.dao.TestDAO.insertData(TestDAO.java:72)
at com.test.dao.TestDAO.main(TestDAO.java:117)
Caused by: java.sql.SQLException: [SQL7008] APAP0400 in TRUGER not valid for operation.
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:650)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:621)
at com.ibm.as400.access.AS400JDBCStatement.commonExecute(AS400JDBCStatement.java:896)
at com.ibm.as400.access.AS400JDBCPreparedStatement.executeUpdate(AS400JDBCPreparedStatement.java:1154)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:23)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2203)
... 13 more
------------------------------
I would like to add that if we set property autocommit "true" in hibernate.cfg file or through connection().setAutocommit() then I am able to use higher isolation levels like 2,4 or 8. But the data is actually not updated in the database.
Ya using journaling solves the problem, but our requirement does not allow to use journaling.
So in short, the exact problem is that I need to use higher isolation levels (2,4 or 8) and update data in the database (db2/AS400) without using journaling.
Software/Hardware used:
ASKED:
August 22, 2008 6:14 AM
UPDATED:
August 22, 2008 1:23 PM