1 Reply Latest reply on Sep 3, 2006 12:51 AM by Andrew Rubinger

    Entity constraint violation - rollback

    Denis Peyrusaubes Newbie


      I'd like to create a method helper on EJB3 entity bean in order to
      check that a set does not violates any constraint.
      ex, in acccount class, i create à debit(a) method, implementing it:

      public void debit(int a)
       if (this.amount>a) {
       } else {

      if this account doesn't have enough money, I'd like to rollback the
      current transaction, in ejb2 I used setRollBackOnly on the context, I did not find any equivalent. The only solution I found is to throw a runtimexception (dirty solution IMO)