All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ibs.ebf.db.EbfTransaction

java.lang.Object
   |
   +----ibs.ebf.db.EbfTransaction

public class EbfTransaction
extends Object
Class EbfTransaction provides transaction management for database connections. Every database activity must be performed using transaction management provided by EbfTransaction object.

EbfTransaction obtains database connections from the database pool performs commit or rollback when requested and redeposits connections back to the connection pool.

Note: Transaction begins with 'beginTransaction' and ends with either 'roolback' or 'commit' method call. Methods must be called in following sequence.
--(1) Create an EbfTransaction object
--(2) call 'beginTransaction( connection_id )' method
--(4) call 'rollback()' or 'commit()' method.
--(5) Nullify the EbfTransaction object.
-- Note: Connections are redeposited back to the connection pool whenever you call 'commit()' or 'rollback()'.

See Also:
IConnection, Connection;

Constructor Index

 o EbfTransaction(boolean)
Constructor for EbfTransaction class.

Method Index

 o beginTransaction(String)
Obtain connection from the connection pool and begin the transaction.
 o commit()
Commit current transaction.
 o finalize()
Redeposit connection to the connection pool.
 o getConnectionId()
Obtain connection id for the connection currently active in this EbfTransaction object.
 o isActive()
Check whether current transaction is active ...
 o rollback()
Rollback current transaction.

Constructors

 o EbfTransaction
 public EbfTransaction(boolean read_only_transaction)
Constructor for EbfTransaction class. Create a new EbfTransaction object and set it either to a READ ONLY transaction or READ/WRITE transaction.

Parameters:
read_only_transaction - - 'true' sets transaction to READ ONLY. 'false' sets transaction to READ WRITE transaction.

Methods

 o beginTransaction
 public IConnection beginTransaction(String connection_id) throws OutOfResourcesException, SQLException
Obtain connection from the connection pool and begin the transaction. EbfTransaction object is responsible for obtaining the connection from the connection pool for the specified connection id.

Throws: OutOfResourcesException
When connection pool runs out of connections. Usually, when this happens, you may wish to sleep for a while (a second or two) and try again - as other processes may have redeposited connection(s) to the pool.
See Also:
IConnection
 o getConnectionId
 public String getConnectionId()
Obtain connection id for the connection currently active in this EbfTransaction object.

Returns:
A connection_id string
 o isActive
 public boolean isActive()
Check whether current transaction is active ...

Returns:
'true' if active, 'false' otherwise.
 o commit
 public void commit() throws SQLException
Commit current transaction. Commit transaction commits the transaction and redeposits all connections used by this transaction to the connection pool.

 o rollback
 public void rollback() throws SQLException
Rollback current transaction. Rollback transaction rolls back the transaction and redeposits all connections used by this transaction to the connection pool.

 o finalize
 protected void finalize()
Redeposit connection to the connection pool.

Overrides:
finalize in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index