}
public void testWithdrawThroughDAS(withdraw wd) throws Exception {
Command select = Command.FACTORY.createCommand("SELECT accountNumber, balance FROM accounts where accountNumber = :accountNumber",
createConfigStream());
Connection conn = createConnection();
select.setConnection(conn);
select.setParameterValue("accountNumber", wd.getAccountNumber());
TypeHelper helper = TypeHelper.INSTANCE;
select.setDataObjectModel(helper.getType(DataGraphRoot.class));
DataGraphRoot root = (DataGraphRoot) select.executeQuery();
Collection accounts = root.getAccountSummaries();
AccountSummary account = (AccountSummary) accounts.iterator().next();
float newbalance = account.getBalance() - wd.getAmount();
account.setBalance(newbalance);
// update department set companyid = ? where department.name = ?
CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(createConfigStream());
commandGroup.setConnection(conn);
Command update = commandGroup.getCommand("update balance");
update.setParameterValue("BALANCE", new Float(newbalance));
update.setParameterValue("ACCOUNTNUMBER", wd.getAccountNumber());
update.execute();
conn.close();
}