public static void commit() {
Object accFromId = (Long)Cache.get("accFrom");
Object accToId = (Long)Cache.get("accTo");
TransactionAccountFromModel accFrom = TransactionAccountFromModel.getByKey(TransactionAccountFromModel.class, accFromId);
TransactionAccountToModel accTo = TransactionAccountToModel.getByKey(TransactionAccountToModel.class, accToId);
try {
accFrom.getPersistenceManager().beginTransaction();
accFrom.amount-=100L;
accFrom.save();
accTo.amount+=100L;
accTo.save();
accFrom.getPersistenceManager().commitTransaction();
}catch(SienaException e){
accFrom.getPersistenceManager().rollbackTransaction();
}finally{
accFrom.getPersistenceManager().closeConnection();