org.cementj.base.trans
Interface TransactionContext

All Known Implementing Classes:
org.cementj.support.trans.AbstractTransactionContext, J2EETransactionContext, JDBCTransactionContext, JNDITransactionContext

public interface TransactionContext

Abstracts transaction control so that classes can be deployment independent. Transaction control for J2EE applications differ from normal Java applications. Consequently it difficult to write applications that can either work with or without a J2EE container.

TransactionContext decouples an application from the way transaction control is managed. Most classes using a TransactionContext for transaction control will be able to function outside a container as they do inside a container.

This interface is meant to be used in conjunction with class BusinessLogicObject from package org.cementj.base.

Copyright: Delta Vortex Technologies, 2003.


Method Summary
 void begin()
          Demarks the beginning of a transaction.
 void closeAll()
          Closes all associated database connections.
 void commitAll()
          Commits your JTA transaction (or all JDBC transactions) in progress.
 java.sql.Connection getConnection(java.lang.String label)
          Provides a JDBC connection given an identifying label.
 java.sql.Connection getNewConnection(java.lang.String label)
          Provides a JDBC connection given an identifying label.
 void rollbackAll()
          Issues rollbacks for your JTA transaction (or all JDBC transactions) in progress.
 

Method Detail

getConnection

java.sql.Connection getConnection(java.lang.String label)
                                  throws TransactionException
Provides a JDBC connection given an identifying label. For applications running under a J2EE container, this label is typically your database connection pool name.

If a connection has previously been created by this transaction context for this identifying label, that connection will be returned. A new connection will not be created. If you explicitly want a new connection, use getNewConnection().

It is imperitive that you don't issue commits, rollbacks, or close connections received from a TransactionContext. Those tasks should be done via the TransactionContext.

Parameters:
label -
Returns:
connection
Throws:
TransactionException

getNewConnection

java.sql.Connection getNewConnection(java.lang.String label)
                                     throws TransactionException
Provides a JDBC connection given an identifying label. For applications running under a J2EE container, this label is typically your database connection pool name.

A new connection will be created and returned regardless of other connections previously created by this context.

It is imperitive that you don't issue commits, rollbacks, or close connections received from a TransactionContext. Those tasks should be done via the TransactionContext.

Parameters:
label -
Returns:
Throws:
TransactionException

commitAll

void commitAll()
               throws TransactionException
Commits your JTA transaction (or all JDBC transactions) in progress.

Throws:
TransactionException

rollbackAll

void rollbackAll()
                 throws TransactionException
Issues rollbacks for your JTA transaction (or all JDBC transactions) in progress.

Throws:
TransactionException

begin

void begin()
           throws TransactionException
Demarks the beginning of a transaction.

Throws:
TransactionException

closeAll

void closeAll()
              throws TransactionException
Closes all associated database connections.

Throws:
TransactionException


Copyright © 2003 Delta Vortex Technologies, Inc. All Rights Reserved.