public <T> T manageTransaction( DatabaseContext ctx, TransactionManagedAction<T> action )
	{
		ctx.db.startTransaction();
		try
		{
			T result = action.execute( ctx );

			ctx.db.commit();

			return result;
		}
		catch( Exception exception )
		{
			ctx.db.rollback();

			throw new ManagedTransactionException( "Exception during managed transaction, see cause for details", exception );
		}
	}
public < T > T manageTransaction ( DatabaseContext ctx , TransactionManagedAction < T > action ) { ctx . db . startTransaction ( ) ; try { T result = action . execute ( ctx ) ; ctx . db . commit ( ) ; return result ; } catch ( Exception exception ) { ctx . db . rollback ( ) ; throw new ManagedTransactionException ( "Exception during managed transaction, see cause for details" , exception ) ; } }
it everything goes fine, commit