@Test public void testCommit() throws Exception { assertEquals(42L, Transaction.execute(new TransactionCallback<Object>() { @Override public Object doInTransaction(final TransactionStatus status) { return 42L; } })); verify(conn).setAutoCommit(false); verify(conn, times(1)).commit(); verify(conn, times(0)).rollback(); verify(conn, times(1)).close(); }
public static <T> T execute(final TransactionCallback<T> callback) { return execute(new TransactionCallbackWithException<T, RuntimeException>() { @Override public T doInTransaction(final TransactionStatus status) throws RuntimeException { return callback.doInTransaction(status); } }); }
Transaction { public static <T> T execute(final TransactionCallback<T> callback) { return execute(new TransactionCallbackWithException<T, RuntimeException>() { @Override public T doInTransaction(final TransactionStatus status) throws RuntimeException { return callback.doInTransaction(status); } }); } }
Transaction { public static <T> T execute(final TransactionCallback<T> callback) { return execute(new TransactionCallbackWithException<T, RuntimeException>() { @Override public T doInTransaction(final TransactionStatus status) throws RuntimeException { return callback.doInTransaction(status); } }); }  }
Transaction { public static <T> T execute(final TransactionCallback<T> callback) { return execute(new TransactionCallbackWithException<T, RuntimeException>() { @Override public T doInTransaction(final TransactionStatus status) throws RuntimeException { return callback.doInTransaction(status); } }); }  static T execute(final TransactionCallback<T> callback); static T execute(final TransactionCallbackWithException<T, E> callback); static T execute(final short databaseId, final TransactionCallback<T> callback); static T execute(final short databaseId, final TransactionCallbackWithException<T, E> callback); }
Transaction { public static <T> T execute(final TransactionCallback<T> callback) { return execute(new TransactionCallbackWithException<T, RuntimeException>() { @Override public T doInTransaction(final TransactionStatus status) throws RuntimeException { return callback.doInTransaction(status); } }); }  static T execute(final TransactionCallback<T> callback); static T execute(final TransactionCallbackWithException<T, E> callback); static T execute(final short databaseId, final TransactionCallback<T> callback); static T execute(final short databaseId, final TransactionCallbackWithException<T, E> callback);  }