Transaction trans = Transaction.getCurrent(id);
AccountEntity acct = new AccountEntity();
boolean success = false;
trans.begin();
try {
AccountFacade fac;
acct.create(id, t, cust);
fac = new AccountFacade(acct);
cust.addAccount(id, fac);
success = true;
return fac;
}
finally {
if( success ) {
try { trans.end(); }
catch( TransactionException e ) { }
}
else {
trans.rollback();
}
}