Atomikos Forum

difference in persistence exception handling in 3.5.8 vs 3.3.3

Hi,

We have a bunch of unit tests relying on Atomikos for out-of-container integration testing. Some of these tests expect to receive an "ORA-28115: policy with check option violation" during database interaction. We test correct behaviour with this code in a catch block

[code]
assertTrue(e instanceof PersistenceException);
PersistenceException pe = (PersistenceException) e;
assertTrue(pe.getCause() instanceof GenericJDBCException);
GenericJDBCException ge = (GenericJDBCException) pe.getCause();
assertEquals(28115, ge.getSQLException().getErrorCode());
[/code]

This works fine on Atomikos 3.3.3.

Yesterday we tried upgrading to Atomikos 3.5.8 and Hibernate 3.2.7 to avoid [1]. The difference that we're seeing now is that these VPD policy tests fail because the exception is not rethrown correctly anymore. e.printStackTrace() now yields this:

org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is javax.transaction.RollbackException: The transaction was set to rollback only
        at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1031)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:732)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:701)
        at org.springframework.test.AbstractTransactionalSpringContextTests.endTransaction(AbstractTransactionalSpringContextTests.java:355)
        at eu.europa.ec.agri.jcore.jam.client.JamClientImplEUMSTest.testAddTupleToUserOnTheLevelOfApplication7(JamClientImplEUMSTest.java:310)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
....
Caused by: javax.transaction.RollbackException: The transaction was set to rollback only
        at com.atomikos.icatch.jta.TransactionImp.commit(TransactionImp.java:311)
        at com.atomikos.icatch.jta.TransactionManagerImp.commit(TransactionManagerImp.java:608)
        at com.atomikos.icatch.jta.UserTransactionImp.commit(UserTransactionImp.java:168)
        at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1028)

Hibernate's jdbc exception reporter still prints the correct exception to the output log however:

09:18:27,981 WARN [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 28115, SQLState: 99999
09:18:27,981 ERROR [org.hibernate.util.JDBCExceptionReporter] - ORA-28115: policy with check option violation

09:18:27,981 WARN [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 28115, SQLState: 99999
09:18:27,981 ERROR [org.hibernate.util.JDBCExceptionReporter] - ORA-28115: policy with check option violation

09:18:27,981 ERROR [org.hibernate.event.def.AbstractFlushingEventListener] - Could not synchronize database state with session
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:266)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
        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 org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
        at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:523)
        at com.atomikos.icatch.jta.Sync2Sync.beforeCompletion(Sync2Sync.java:73)
..............
Caused by: java.sql.BatchUpdateException: ORA-28115: policy with check option violation

        at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
        at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10768)
        at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
        at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)

Can anyone confirm this regression ? Rolling back to Hibernate 3.2.6 did not fix the problem, so i'm pretty sure it is the new Atomikos version that is causing problems.

Regards
Jorg Heymans

[1] http://opensource.atlassian.com/projects/hibernate/browse/HHH-3358
Jorg Heymans Send private email
Friday, September 25, 2009
 
 
FWIW I just tested with 3.5.4 and the exception is the same.
Jorg Heymans Send private email
Friday, September 25, 2009
 
 
Hi,

The connection pools have changed in this newer version. What does the tm.out say?

Guy
Guy Pardon Send private email
Friday, September 25, 2009
 
 
Actually,

We no longer allow beforeCompletion calls (like Hibernate's) to exit with a RuntimeException - this was problematic as reported here:

default82df.html?community.6.231.1

That is why you don't get the error at the application level...

HTH
Guy Pardon Send private email
Friday, September 25, 2009
 
 
Guy,

Thanks for your feedback. I verified the behaviour against Weblogic JTA transaction manager (9.2MP2) and it shows the same behaviour as Atomikos 3.5.8. This is good !

So i guess i will have to change my unit test now to no longer rely on this kind of exception propagation anymore :-)

Thanks,
Jorg
Jorg Heymans Send private email
Monday, September 28, 2009
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics