Hi, 

currently if a tx will be rollbacked, the SpringTransaction class kind of 
swallow the root cause in the following code 

catch (TransactionSystemException e)
  |       {
  |          log.error("Exception cause:", e);
  |          throw new SystemException(e.getMessage());
  |       }
  |       catch (UnexpectedRollbackException e)
  |       {
  |          log.error("Exception cause:", e);
  |          throw new RollbackException(e.getMessage());
  |       }

It is essential to pass the whole cause exception in SystemException and 
RollbackException instead of only a text message. 

My use case is the following:
JSF delete action method tries to delete a row in the db. When the tx commits, 
it discovers the row can not be deleted because of foreign key constraint. I 
would like to have the ConstraintViolationException wrapped in the 
RollbackException, so that I have a chance to handle this exception later with 
the exception handler. 

In the current implmenetation, the RollbacklException with only text message 
and no cause stack will later be wrapped as an IllegalStateException, which is 
not helpful for exception handling at all.



View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4104298#4104298

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4104298
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to