### Question:
TransactionManager { public <T> T callInTransaction(final Callable<T> callable) throws SQLException { return callInTransaction(connectionSource, callable); } TransactionManager();  TransactionManager(ConnectionSource connectionSource); void initialize(); T callInTransaction(final Callable<T> callable); T callInTransaction(String tableName, final Callable<T> callable); static T callInTransaction(final ConnectionSource connectionSource, final Callable<T> callable); static T callInTransaction(String tableName, final ConnectionSource connectionSource,
			final Callable<T> callable); static T callInTransaction(final DatabaseConnection connection, final DatabaseType databaseType,
			final Callable<T> callable); static T callInTransaction(final DatabaseConnection connection, boolean saved,
			final DatabaseType databaseType, final Callable<T> callable); void setConnectionSource(ConnectionSource connectionSource);  }### Answer:
@Test public void testTransactionWithinTransaction() throws Exception { if (connectionSource == null) { return; } final TransactionManager mgr = new TransactionManager(connectionSource); final Dao<Foo, Integer> dao = createDao(Foo.class, true); mgr.callInTransaction(new Callable<Void>() { @Override public Void call() throws Exception { testTransactionManager(mgr, null, dao); return null; } }); }
@Test public void testTransactionWithinTransactionFails() throws Exception { if (connectionSource == null) { return; } final TransactionManager mgr = new TransactionManager(connectionSource); final Dao<Foo, Integer> dao = createDao(Foo.class, true); try { mgr.callInTransaction(new Callable<Void>() { @Override public Void call() throws Exception { dao.create(new Foo()); mgr.callInTransaction(new Callable<Void>() { @Override public Void call() throws Exception { dao.create(new Foo()); throw new SQLException("Exception ahoy!"); } }); return null; } }); fail("Should have thrown"); } catch (SQLException se) { } List<Foo> results = dao.queryForAll(); assertNotNull(results); assertEquals(0, results.size()); }