[jboss-user] [EJB/JBoss] - @ApplicationException(rollback=false) does roll back @PreUpd

skeyewalk do-not-reply at jboss.com
Thu Jan 10 04:46:38 EST 2008


I have encountered a very unfortunate and strange difference in the way JBoss application server 4.2.2 treats exceptions raised from inside EJB callback methods marked with @PrePersist and @PreUpdate.

My exception is a RuntimeException, and is marked for rollback=false. I use it to report back validation errors. The validation is triggered in the @PrePersist and @PreUpdate callback methods. However, while this behaves very nicely for the persist method, the update does not appear to take the @ApplicationException annotation into account. So the transaction is rolled back and my exception is wrapped inside a javax.persistence.PersistenceException and then inside a javax.transaction.RollbackException, blowing up my whole concept.

I have also tried configuring the ApplicationException in the ejb-jar.xml, but the result was identical.

Here's the exception class:

@ApplicationException(rollback=false)
  | public class ValidationExceptionRuntimeWrapper extends RuntimeException
  | {
  |   private static final long serialVersionUID = 1L;
  |   
  |   private ValidationException validationException;
  | 
  |   
  |   public ValidationExceptionRuntimeWrapper(ValidationException validationException)
  |   {
  |     this.validationException = validationException;
  |   }
  | 
  |   public ValidationException getValidationException()
  |   {
  |     return validationException;
  |   }
  | 
  |   public void setValidationException(ValidationException validationException)
  |   {
  |     this.validationException = validationException;
  |   }
  |   
  | }
  | 

Has anyone seen this before or knows how to explain this?
I would be so grateful for any help!!


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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118553



More information about the jboss-user mailing list