Hi All,
I am using Spring and Hibernate. And Atomikos for transactions. I use annotation based transactions. I am having a DAO object and in one of the methods I call entityManager.persist() to save the object. Now whenever there is an ORA- error during update, for example a constraint is violated or one of the columns is having length more than wat is defined in the database, I get a JTAUnexpectedRollbackException instead of the GenericJDBCException that is thrown by Spring. I tried putting a try around persist to catch that, but I am not getting any exception there. Seems Hibernate does the actual update statement during flush, which happens during the transaction commit and hence the UnexpectedRollbackException I guess.
How can I get around this and get the GenericJDBCException instead of the UnexpectedRollbackException?