private void useTransactions(ConnectionSource connectionSource) throws Exception {
String name = "trans1";
final Account account = new Account(name);
assertEquals(1, accountDao.create(account));
TransactionManager transactionManager = new TransactionManager(connectionSource);
try {
// try something in a transaction
transactionManager.callInTransaction(new Callable<Void>() {
public Void call() throws Exception {
// we do the delete
assertEquals(1, accountDao.delete(account));
assertNull(accountDao.queryForId(account.getId()));
// but then (as an example) we throw an exception which rolls back the delete