// Select source and destination
BalanceData source = uow.get( BalanceData.class, SAVINGS_ACCOUNT_ID );
BalanceData destination = uow.get( BalanceData.class, CHECKING_ACCOUNT_ID );
// Instantiate context and execute enactments with that context
TransferMoneyContext2 context = module.newTransient( TransferMoneyContext2.class )
.bind( source, destination );
// Query for double the balance
final Integer amountToTransfer = context.availableFunds() * 2;
// Transfer from savings to checking
context.transfer( amountToTransfer );
}
finally
{
uow.discard();
}