sf logo

sf.qof.session
Interface TransactionRunnable<T>

Type Parameters:
T - the type of the result of a call to run. If no result is returned this type should be Void

public interface TransactionRunnable<T>

The TransactionRunnable interface should be implemented for code that needs to be run in a transactional context.

Typical usage is like this:

 TransactionRunnable<Void> runnable = new TransactionRunnable<Void>() {
         public Void run(Connection connection, Object... arguments) throws SQLException {
     List<Person> personList = (List<Person>)arguments[0];
     PreparedStatement ps = connection.prepareStatement("...");
     ...
     return null;
   }
 };
 

See Also:
SessionRunner

Method Summary
 T run(Connection connection, Object... arguments)
          This method is called by a SessionRunner.
 

Method Detail

run

T run(Connection connection,
      Object... arguments)
      throws SQLException
This method is called by a SessionRunner.

Parameters:
connection - the database connection
arguments - a variable list of arguments
Returns:
a result
Throws:
SQLException - thrown if an exception occured. This will force a rollback of the transaction
See Also:
SessionRunner

sf logo

Copyright © 2007 brunella ltd. All Rights Reserved.