org.apache.ojb.odmg
Interface TransactionExt

All Superinterfaces:
HasBroker, Transaction
All Known Implementing Classes:
J2EETransactionImpl, NarrowTransaction, TransactionImpl

public interface TransactionExt
extends Transaction, HasBroker

Offers useful none odmg-standard methods of the odmg Transaction interface.

Note: All listed methods are not part of the standard ODMG-api - they are special (proprietary) OJB extensions.

Version:
$Id: TransactionExt.java 365232 2005-12-21 22:36:07Z tomdz $

Field Summary
 
Fields inherited from interface org.odmg.Transaction
READ, UPGRADE, WRITE
 
Method Summary
 void flush()
           Calling flush flushes persistent object modifications made within the ODMG transaction since the last checkpoint to the underlying database transaction, but does commit the database transaction.
 boolean isDeleted(Identity id)
          Checks if the object with the given Identity has been deleted within the transaction using Database.deletePersistent(Object) or markDelete(Object).
 boolean isImplicitLocking()
          Returns true if implicite locking is enabled.
 boolean isOrdering()
          Return true if the OJB ordering algorithm is enabled.
 void markDelete(java.lang.Object anObject)
          Marks an object for deletion without locking the object.
 void markDirty(java.lang.Object anObject)
          Marks an object as dirty without locking the object.
 void setCascadingDelete(java.lang.Class target, boolean doCascade)
          Allows to change the cascading delete behavior of all references of the specified class while this transaction is in use.
 void setCascadingDelete(java.lang.Class target, java.lang.String referenceField, boolean doCascade)
          Allows to change the cascading delete behavior of the target class's reference field while this transaction is in use.
 void setImplicitLocking(boolean value)
          This method can be used to activate or deactivate the implicit locking mechanism for the current transaction.
 void setOrdering(boolean ordering)
          Allows to enable/disable the OJB persistent object ordering algorithm.
 
Methods inherited from interface org.odmg.Transaction
abort, begin, checkpoint, commit, isOpen, join, leave, lock, tryLock
 
Methods inherited from interface org.apache.ojb.odmg.HasBroker
getBroker
 

Method Detail

markDelete

void markDelete(java.lang.Object anObject)
Marks an object for deletion without locking the object. If the object wasn't locked before, OJB will ask for a WRITE lock at commit.

Parameters:
anObject - Object to be marked

markDirty

void markDirty(java.lang.Object anObject)
Marks an object as dirty without locking the object. If the object wasn't locked before, OJB will ask for a WRITE lock at commit.

Parameters:
anObject - Object to be marked

flush

void flush()

Calling flush flushes persistent object modifications made within the ODMG transaction since the last checkpoint to the underlying database transaction, but does commit the database transaction. The ODMG transaction retains all locks it held on those objects at the time the flush was invoked.

This method is very similair to Transaction.checkpoint().


setImplicitLocking

void setImplicitLocking(boolean value)
This method can be used to activate or deactivate the implicit locking mechanism for the current transaction.
If set true OJB implicitly locks objects to ODMG transactions after performing OQL queries. Also if implicit locking is used locking objects is recursive, that is associated objects are also locked. If ImplicitLocking is set to 'false', no locks are obtained in OQL queries, lookup objects and there is also no recursive locking.

Turning off implicit locking may improve performance but requires additional care to make sure all changed objects are properly registered to the transaction.

Parameters:
value - If set true implicit locking is enabled, if false, implicit locking is disabled.
See Also:
ImplementationExt.setImplicitLocking(boolean)

isImplicitLocking

boolean isImplicitLocking()
Returns true if implicite locking is enabled.

See Also:
setImplicitLocking(boolean)

setCascadingDelete

void setCascadingDelete(java.lang.Class target,
                        java.lang.String referenceField,
                        boolean doCascade)
Allows to change the cascading delete behavior of the target class's reference field while this transaction is in use.

Parameters:
target - The class to change cascading delete behavior of the references.
referenceField - The field name of the 1:1, 1:n or m:n reference.
doCascade - If true cascading delete is enabled, false disabled.

setCascadingDelete

void setCascadingDelete(java.lang.Class target,
                        boolean doCascade)
Allows to change the cascading delete behavior of all references of the specified class while this transaction is in use.

Parameters:
target - The class to change cascading delete behavior of all references.
doCascade - If true cascading delete is enabled, false disabled.

isOrdering

boolean isOrdering()
Return true if the OJB ordering algorithm is enabled.

See Also:
setOrdering(boolean)

setOrdering

void setOrdering(boolean ordering)
Allows to enable/disable the OJB persistent object ordering algorithm. If true OJB try to order the modified/new/deleted objects in a correct order (based on a algorithm) before the objects are written to the persistent storage.
If the used databases support 'deferred checks' it's recommended to use this feature and to disable OJB's object ordering.

If false the order of the objects rely on the order specified by the user and on settings like setImplicitLocking(boolean).

Parameters:
ordering - Set true to enable object ordering on commit.
See Also:
ImplementationExt.setOrdering(boolean)

isDeleted

boolean isDeleted(Identity id)
Checks if the object with the given Identity has been deleted within the transaction using Database.deletePersistent(Object) or markDelete(Object).

Parameters:
id - The identity of the object.
Returns:
true if the object has been deleted within the transaction.


(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