1 Reply Latest reply on Dec 22, 2008 7:13 AM by Ingo Jobling

    ApplicationException Seam 2.1.0 SP1 does not works

    soares gouveia Newbie

      Im trying to use the @ApplicationException  annotation in the Seam JPA sample in Tomcat 6.
      But it seems does not work. When I insert the @ApplicationException  in my exception class, if that exception happens, no rollback is activated... I tried to use the


      "

      rollback=true

      "


      property but in this case the entity is not persisted anymore... Is this problem a bug or is my mistake? Could you help me? here is the source code.





      import org.jboss.seam.annotations.ApplicationException;
      
      @ApplicationException
      public class DAOException extends BasicException {
      
              /**
               * 
               */
              private static final long serialVersionUID = 1L;
      
              public DAOException() {
              }
      
              public DAOException(Exception e) {
                      super(e);
              }
      
              public DAOException(String msg) {
                      super(msg);
              }
      }
      
      
      
      import org.jboss.seam.annotations.ApplicationException;
      
      @ApplicationException
      public class BusinessException extends BasicException {
      
              /**
               * 
               */
              private static final long serialVersionUID = 1L;
      
              public BusinessException() {
              }
      
              public BusinessException(Exception e) {
                      super(e);
              }
      
              public BusinessException(String msg) {
                      super(msg);
              }
      }
      
      
              @Transactional
              public void register(User user) throws BusinessException {
                      try {
       
                                      userDAO.persist(user);
                                      // Here I forced an exception, but no rollbacks happens
                                      throw new BusinessException("Illegal name.");
      
                      } catch (DAOException e) {
                              throw new BusinessException(e);
                      }
              }