org.apache.ojb.odmg
Class J2EETransactionImpl

java.lang.Object
  extended by org.apache.ojb.odmg.TransactionImpl
      extended by org.apache.ojb.odmg.J2EETransactionImpl
All Implemented Interfaces:
javax.transaction.Synchronization, CollectionProxyListener, MaterializationListener, org.apache.ojb.broker.util.configuration.Configurable, HasBroker, TransactionExt, Transaction

public class J2EETransactionImpl
extends TransactionImpl
implements javax.transaction.Synchronization

Implementation for use in managed environments.

Version:
$Id: J2EETransactionImpl.java 365232 2005-12-21 22:36:07Z tomdz $
Author:
Matthew Baird

Constructor Summary
J2EETransactionImpl(ImplementationImpl implementation)
           
 
Method Summary
 void abort()
          Abort and close the transaction.
 void afterCompletion(int status)
          FOR internal use.
 void beforeCompletion()
          FOR internal use.
 void checkpoint()
          Commit the transaction, but reopen the transaction, retaining all locks.
 void commit()
          Commit and close the transaction.
 boolean isInExternTransaction()
           
 void join()
          Attach the caller's thread to this Transaction and detach the thread from any former Transaction the thread may have been associated with.
 void leave()
          Detach the caller's thread from this Transaction , but do not attach the thread to another Transaction .
 void setInExternTransaction(boolean mode)
           
 
Methods inherited from class org.apache.ojb.odmg.TransactionImpl
afterLoading, afterMaterialization, beforeLoading, beforeMaterialization, begin, configure, deletePersistent, flush, getAssociatedDatabase, getBroker, getBrokerInternal, getGUID, getImplementation, getNamedRootsMap, getObjectByIdentity, isDeleted, isImplicitLocking, isOpen, isOrdering, lock, lockAndRegister, lockAndRegister, markDelete, markDirty, setCascadingDelete, setCascadingDelete, setImplicitLocking, setOrdering, tryLock
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

J2EETransactionImpl

public J2EETransactionImpl(ImplementationImpl implementation)
Method Detail

setInExternTransaction

public void setInExternTransaction(boolean mode)

isInExternTransaction

public boolean isInExternTransaction()

join

public void join()
Description copied from class: TransactionImpl
Attach the caller's thread to this Transaction and detach the thread from any former Transaction the thread may have been associated with.

Specified by:
join in interface Transaction
Overrides:
join in class TransactionImpl

leave

public void leave()
Description copied from class: TransactionImpl
Detach the caller's thread from this Transaction , but do not attach the thread to another Transaction .

Specified by:
leave in interface Transaction
Overrides:
leave in class TransactionImpl

checkpoint

public void checkpoint()
Description copied from class: TransactionImpl
Commit the transaction, but reopen the transaction, retaining all locks. Calling checkpoint commits persistent object modifications made within the transaction since the last checkpoint to the database. The transaction retains all locks it held on those objects at the time the checkpoint was invoked.

Specified by:
checkpoint in interface Transaction
Overrides:
checkpoint in class TransactionImpl

afterCompletion

public void afterCompletion(int status)
FOR internal use. This method was called after the external transaction was completed.

Specified by:
afterCompletion in interface javax.transaction.Synchronization
See Also:
Synchronization

beforeCompletion

public void beforeCompletion()
FOR internal use. This method was called before the external transaction was completed. This method was called by the JTA-TxManager before the JTA-tx prepare call. Within this method we prepare odmg for commit and pass all modified persistent objects to DB and release/close the used connection. We have to close the connection in this method, because the TxManager does prepare for commit after this method and all used DataSource-connections have to be closed before.

Specified by:
beforeCompletion in interface javax.transaction.Synchronization
See Also:
Synchronization

commit

public void commit()
Description copied from class: TransactionImpl
Commit and close the transaction. Calling commit commits to the database all persistent object modifications within the transaction and releases any locks held by the transaction. A persistent object modification is an update of any field of an existing persistent object, or an update or creation of a new named object in the database. If a persistent object modification results in a reference from an existing persistent object to a transient object, the transient object is moved to the database, and all references to it updated accordingly. Note that the act of moving a transient object to the database may create still more persistent references to transient objects, so its referents must be examined and moved as well. This process continues until the database contains no references to transient objects, a condition that is guaranteed as part of transaction commit. Committing a transaction does not remove from memory transient objects created during the transaction. The updateObjectList contains a list of all objects for which this transaction has write privledge to. We need to update these objects.

Specified by:
commit in interface Transaction
Overrides:
commit in class TransactionImpl

abort

public void abort()
Description copied from class: TransactionImpl
Abort and close the transaction. Calling abort abandons all persistent object modifications and releases the associated locks. Aborting a transaction does not restore the state of modified transient objects

Specified by:
abort in interface Transaction
Overrides:
abort in class TransactionImpl


(C) 2002 - 2006 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30