sqlg2.db
Interface ITransaction

All Superinterfaces:
ISimpleTransaction, java.rmi.Remote
All Known Implementing Classes:
Transaction

public interface ITransaction
extends ISimpleTransaction

Adds transaction control methods to ISimpleTransaction - commit() and rollback(). Business method calls on objects, obtained from getInterface(Class) are not automatically committed or rolled back. ITransaction holds resources (DB connection) until explicit call to commit() or rollback(), so you must call one of them once you start transaction (else resource leak may occur). If single-connection pool is used, then you cannot call something from other transactions (even from simple transactions) during active transaction - they have to wait until single DB connection is released by the current transaction. In most cases voilation of this rule leads to deadlock, so if you are using ITransaction then all data access interfaces should by obtained from it, not from other transactions.


Method Summary
 void commit()
          Commits transaction.
<T extends IDBCommon>
T
getInterface(java.lang.Class<T> iface)
          Returns data access interface generated by preprocessor.
 void rollback()
          Rolls back transaction.
 

Method Detail

getInterface

<T extends IDBCommon> T getInterface(java.lang.Class<T> iface)
                                 throws java.rmi.RemoteException
Description copied from interface: ISimpleTransaction
Returns data access interface generated by preprocessor.

Specified by:
getInterface in interface ISimpleTransaction
Parameters:
iface - interface class
Returns:
data access interface implementation
Throws:
java.rmi.RemoteException

rollback

void rollback()
              throws java.rmi.RemoteException,
                     java.sql.SQLException
Rolls back transaction.

Throws:
java.rmi.RemoteException
java.sql.SQLException

commit

void commit()
            throws java.rmi.RemoteException,
                   java.sql.SQLException
Commits transaction.

Throws:
java.rmi.RemoteException
java.sql.SQLException