org.exolab.castor.jdo.engine
Class TransactionContextImpl
java.lang.Object
org.exolab.castor.persist.TransactionContext
org.exolab.castor.jdo.engine.TransactionContextImpl
- final class TransactionContextImpl
- extends TransactionContext
A transaction context is required in order to perform operations
against the database. The transaction context is mapped to Transaction
for the ODMG API and into
XAResource
for XA databases. The only
way to begin a new transaction is through the creation of a new
transaction context. All database access must be performed through
a transaction context.
- Version:
- $Revision: 1.2 $ $Date: 2003/03/03 17:14:16 $
- Author:
- Assaf Arkin
Method Summary |
protected void |
closeConnections()
The derived class must implement this method and close all the
connections used in this transaction. |
protected void |
commitConnections()
The derived class must implement this method and commit all the
connections used in this transaction. |
java.lang.Object |
getConnection(LockEngine engine)
The derived class must implement this method and return an open
connection for the specified engine. |
protected void |
rollbackConnections()
The derived class must implement this method and rollback all
the connections used in this transaction. |
Methods inherited from class org.exolab.castor.persist.TransactionContext |
addTxSynchronizable, close, commit, create, delete, fetch, getClassLoader, getDatabase, getIdentity, getLockTimeout, getObjectState, getScope, getStatus, getTransactionTimeout, getXid, isAutoStore, isDeleted, isDeletedByOID, isDepended, isOpen, isPersistent, isReadOnly, isRecorded, load, load, markCreate, markModified, markUpdate, prepare, query, query, release, removeTxSynchronizable, rollback, setAutoStore, setCallback, setInstanceFactory, setLockTimeout, setTransactionTimeout, softLock, txcommitted, txrolledback, update, writeLock |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TransactionContextImpl
public TransactionContextImpl(Database db,
boolean globalTx)
- Create a new transaction context.
commitConnections
protected void commitConnections()
throws TransactionAbortedException
- Description copied from class:
TransactionContext
- The derived class must implement this method and commit all the
connections used in this transaction. If the transaction could
not commit fully or partially, this method will throw an
TransactionAbortedException
, causing a rollback to occur as
the next step.
- Specified by:
commitConnections
in class TransactionContext
- Throws:
TransactionAbortedException
- The transaction could not
commit fully or partially and should be rolled back
closeConnections
protected void closeConnections()
throws TransactionAbortedException
- Description copied from class:
TransactionContext
- The derived class must implement this method and close all the
connections used in this transaction.
- Specified by:
closeConnections
in class TransactionContext
- Throws:
TransactionAbortedException
- The transaction could not
close all the connections
rollbackConnections
protected void rollbackConnections()
- Description copied from class:
TransactionContext
- The derived class must implement this method and rollback all
the connections used in this transaction. The connections may
be closed, as they will not be reused in this transaction.
This operation is guaranteed to succeed.
- Specified by:
rollbackConnections
in class TransactionContext
getConnection
public java.lang.Object getConnection(LockEngine engine)
throws PersistenceException
- Description copied from class:
TransactionContext
- The derived class must implement this method and return an open
connection for the specified engine. The connection should be
created only one for a given engine in the same transaction.
- Specified by:
getConnection
in class TransactionContext
- Parameters:
engine
- The persistence engine
- Returns:
- An open connection
- Throws:
PersistenceException
- An error occured talking to the
persistence engine
Intalio Inc. (C) 1999-2003. All rights reserved http://www.intalio.com