com.googlecode.flyway.core.util.jdbc
Class TransactionTemplate

java.lang.Object
  extended by com.googlecode.flyway.core.util.jdbc.TransactionTemplate

public class TransactionTemplate
extends java.lang.Object

Spring-like template for executing transactions.


Constructor Summary
TransactionTemplate(java.sql.Connection connection)
          Creates a new transaction template for this connection.
 
Method Summary
<T> T
execute(TransactionCallback<T> transactionCallback)
          Executes this callback within a transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionTemplate

public TransactionTemplate(java.sql.Connection connection)
Creates a new transaction template for this connection.

Parameters:
connection - The connection for the transaction.
Method Detail

execute

public <T> T execute(TransactionCallback<T> transactionCallback)
          throws TransactionException
Executes this callback within a transaction.

Parameters:
transactionCallback - The callback to execute.
Returns:
The result of the transaction code.
Throws:
TransactionException - when the transaction execution failed.


Copyright © 2012. All Rights Reserved.