[jboss-user] [JBoss Seam] - Re: org.hibernate.exception.GenericJDBCException: Cannot ope

fernando_jmt do-not-reply at jboss.com
Wed Sep 19 10:06:04 EDT 2007


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



More information about the jboss-user mailing list