[jboss-user] [EJB 3.0] - Entity constraint violation - rollback

Dens do-not-reply at jboss.com
Sat Sep 2 18:47:12 EDT 2006


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) {
  |    setAmount(getAmount()-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)

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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3969068

More information about the jboss-user mailing list