2 Replies Latest reply on Oct 3, 2005 11:19 AM by bill.burke

    Bug or...?

    trofimov

      I use:

       @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
       public void add(String product)
       throws Exception {
      
       contractor = new Contractor();
       contractor.setName(product);
       manager.persist(contractor);
       int i=0/0; // Exception: / zero
       }
      


      Transaction is rollback

      But if i use:

      @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
       public void add(String product)
       throws Exception {
      
       contractor = new Contractor();
       contractor.setName(product);
       manager.persist(contractor);
       throw new Exception("New message"); // Simple Exception :)
       }
      

      Transaction after exception is commited.
      Help me solve this problem.
      Thanx.