EntryDuplicatedException is a custome exception I have:

  | 
  | @ApplicationException(rollback = true)
  | public class EntryDuplicatedException extends Exception {
  | 
  |     public EntryDuplicatedException() {
  |     }
  |    
  | }
  | 

addDuplicatedMessage() is just a simple method to add the error message to the 
view (FacesMessages..)

Finally, you should use @TransactionAttribute(REQUIRES_NEW) for the especific 
method you want to recover after the transaction fails:


  | @TransactionAttribute(REQUIRES_NEW)
  |     public void update(User entity) throws ConcurrencyException, 
EntryDuplicatedException {
  |         try {
  |             em.merge(entity);
  |             em.flush();
  |         } catch (EntityExistsException ee) {
  |             throw new EntryDuplicatedException(ee);
  |         }
  |     }
  | 
  | 



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

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

Reply via email to