toolbox.dao
Interface TransactionContext

Package class diagram package TransactionContext
All Known Implementing Classes:
TransactionCtxImpl

public interface TransactionContext

Interface defining an abstraction for JDBC transaction handling. This will provide a context in which a single database transaction can be executed.


Method Summary
 void commit()
          Commits the transaction.
 java.sql.Connection getConnection()
          Returns the connection used by this context.
 void rollback()
          Rolls back the transaction.
 void setConnection(java.sql.Connection conn)
          Set the connection that this context will use.
 

Method Detail

setConnection

void setConnection(java.sql.Connection conn)
                   throws DaoException
Set the connection that this context will use. This method must ensure that auto commit is turned off.

Parameters:
conn - Connection this context will use for Database communication.
Throws:
DaoException - if the connection cannot be prepared for transactional purposes.

getConnection

java.sql.Connection getConnection()
Returns the connection used by this context.

Returns:
Connection used by this context.

commit

void commit()
            throws DaoException
Commits the transaction.

Throws:
DaoException - if the transaction cannot be committed.

rollback

void rollback()
              throws DaoException
Rolls back the transaction.

Throws:
DaoException - if transaction cannot be rolled back.