The Teller Class - Add a
transferMoney() method:
public void transferMoney(long fromAccountNo, long toAccountNo, int
amount) {
Transaction transaction =
null;
try {
PersistenceManager pManager =
this.pmFactory_.getPersistenceManager();
transaction =
pManager.currentTransaction();
transaction.begin();
Account
fromAccount=(Account)pManager.getObjectById(new Oid(fromAccountNo),
true);
Account toAccount =
(Account)pManager.getObjectById(new Oid(toAccountNo),
true);
fromAccount.debit(amount);
toAccount.credit(amount);
transaction.commit();
} catch(Exception
exception) {
transaction.rollback();
}
}