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
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to