Class TransactionalExecutionTemplate

    • Constructor Detail

      • TransactionalExecutionTemplate

        public TransactionalExecutionTemplate​(Connection connection,
                                              boolean rollbackOnException)
        Creates a new transaction template for this connection.
        Parameters:
        connection - The connection for the transaction.
        rollbackOnException - Whether to roll back the transaction when an exception is thrown.
    • Method Detail

      • execute

        public <T> T execute​(Callable<T> callback)
        Executes this callback within a transaction.
        Specified by:
        execute in interface ExecutionTemplate
        Parameters:
        callback - The callback to execute.
        Returns:
        The result of the transaction code.