net.sf.eodsql
Interface TransactionQuery

All Superinterfaces:
BaseQuery

public interface TransactionQuery
extends BaseQuery

An extension to the default BaseQuery that holds a transaction. A TransactionQuery opens a database transaction when it is created, and as a side-effect, also holds a Connection to the database. Unlike a normal BaseQuery, a TransactionQuery will not affect the database until the commit() method is invoked.

Author:
jason

Method Summary
 void close(boolean commit)
          Closes this TransactionQuery optionally calling commit() before closing the Connection to the database.
 void commit()
          Makes all the changes to the database since the last commit / rollback permanent.
 void rollback()
          Undoes any changes made by this TransactionQuery.
 void rollback(Savepoint savepoint)
          Undoes any changes from the specified Savepoint up to the current location in the transaction.
 Savepoint setSavepoint()
          Sets an unnamed savepoint at the current location in the transaction.
 Savepoint setSavepoint(String name)
          Sets a named Savepoint at the current position within the transaction.
 
Methods inherited from interface net.sf.eodsql.BaseQuery
close, isClosed
 

Method Detail

close

void close(boolean commit)
Closes this TransactionQuery optionally calling commit() before closing the Connection to the database.

Parameters:
commit - true if commit() should be called before closing, or false if nothing is done to the underlying Connection before closing.

commit

void commit()
Makes all the changes to the database since the last commit / rollback permanent.


rollback

void rollback()
Undoes any changes made by this TransactionQuery.


rollback

void rollback(Savepoint savepoint)
Undoes any changes from the specified Savepoint up to the current location in the transaction.

Parameters:
savepoint - the Savepoint that marks the current position in the transaction

setSavepoint

Savepoint setSavepoint()
Sets an unnamed savepoint at the current location in the transaction. This Savepoint can be used to rollback the transaction to this point.

Returns:
a new, unnamed Savepoint for this location in the transaction

setSavepoint

Savepoint setSavepoint(String name)
Sets a named Savepoint at the current position within the transaction.

Parameters:
name - the name of the new Savepoint
Returns:
the Savepoint at the current location in the transaction