Transaction trans = Transaction.getCurrent(id);
CustomerEntity cust = new CustomerEntity();
boolean success = false;
trans.begin();
try {
cust.create(id, fn, ln, ssn);
success = true;
return new CustomerFacade(cust);
}
finally {
if( success ) {
System.out.println("Ending transaction...");
try { trans.end(); }
catch( TransactionException e ) { }
}
else {
trans.rollback();
}
}