
org.apache.ojb.odmg.TransactionExt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of db-ojb Show documentation
Show all versions of db-ojb Show documentation
ObJectRelationalBridge (OJB) is an Object/Relational mapping tool that
allows transparent persistence for Java Objects against relational
databases.
The newest version!
package org.apache.ojb.odmg;
/* Copyright 2003-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.odmg.Transaction;
import org.apache.ojb.broker.Identity;
/**
* Offers useful none odmg-standard methods of the odmg {@link org.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,v 1.1 2007-08-24 22:17:37 ewestfal Exp $
*/
public interface TransactionExt extends Transaction, HasBroker
{
/**
* 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.
*
* @param anObject Object to be marked
*/
public void markDelete(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.
*
* @param anObject Object to be marked
*/
public void markDirty(Object anObject);
/**
*
* 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 {@link org.odmg.Transaction#checkpoint}.
*/
public void flush();
/**
* 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.
*
* @param value If set true implicit locking is enabled,
* if false, implicit locking is disabled.
* @see ImplementationExt#setImplicitLocking(boolean)
**/
public void setImplicitLocking(boolean value);
/**
* Returns true if implicite locking is enabled.
* @see #setImplicitLocking(boolean)
*/
public boolean isImplicitLocking();
/**
* Allows to change the cascading delete behavior of the target class's
* reference field while this transaction is in use.
*
* @param target The class to change cascading delete behavior of the references.
* @param referenceField The field name of the 1:1, 1:n or m:n reference.
* @param doCascade If true cascading delete is enabled, false disabled.
*/
public void setCascadingDelete(Class target, String referenceField, boolean doCascade);
/**
* Allows to change the cascading delete behavior of all references of the
* specified class while this transaction is in use.
*
* @param target The class to change cascading delete behavior of all references.
* @param doCascade If true cascading delete is enabled, false disabled.
*/
public void setCascadingDelete(Class target, boolean doCascade);
/**
* Return true if the OJB ordering algorithm is enabled.
* @see #setOrdering(boolean)
*/
public boolean isOrdering();
/**
* 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 {@link #setImplicitLocking(boolean)}.
*
* @param ordering Set true to enable object ordering on commit.
* @see ImplementationExt#setOrdering(boolean)
*/
public void setOrdering(boolean ordering);
// /**
// * Returns whether or not the persistent method calls determine
// * the persistent object order on commit.
// *
// * @see #setNoteUserOrder(boolean)
// */
// public boolean isNoteUserOrder();
//
// /**
// * If true the order of persisting method calls like
// *
- {@link org.odmg.Transaction#lock(Object, int)}).
// *
- {@link org.odmg.Database#deletePersistent(Object)}).
// *
- {@link org.odmg.Database#makePersistent(Object)})
// * determine the order of objects before commit.
// *
// * If false the ordering was determined by OJB's internal
// * method calls and user calls.
// *
// * However it's possible to set this value as a global property
// * for all transactions using {@link ImplementationExt#setNoteUserOrder(boolean)}.
// *
// * NOTE: If OJB's ordering algorithm (see
// * {@link #setOrdering(boolean)}) is enabled, the
// * order of objects may change on commit.
// *
// * @param noteUserOrder If true the order of persisting
// * method calls determine the order of objects.
// * @see ImplementationExt#setNoteUserOrder(boolean)
// */
// public void setNoteUserOrder(boolean noteUserOrder);
/**
* Checks if the object with the given {@link org.apache.ojb.broker.Identity}
* has been deleted within the transaction using
* {@link org.odmg.Database#deletePersistent(Object)} or {@link #markDelete(Object)}.
*
* @param id The identity of the object.
* @return true if the object has been deleted within the transaction.
*/
public boolean isDeleted(Identity id);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy