Skip navigation links

Oracle® Data Integrator Java API Reference
11g Release 1 (11.1.1.7.0)

E17060-04


oracle.odi.core.persistence.transaction.support
Class TransactionTemplate

java.lang.Object
  extended by oracle.odi.core.persistence.transaction.support.DefaultTransactionDefinition
      extended by oracle.odi.core.persistence.transaction.support.TransactionTemplate

All Implemented Interfaces:
ITransactionDefinition

public class TransactionTemplate
extends DefaultTransactionDefinition

Template class that simplifies programmatic transaction demarcation and transaction exception handling against an ITransactionManager.

The central method is execute(ITransactionCallback), supporting transactional code that implements the ITransactionCallback interface. This template handles the transaction lifecycle and possible exceptions such that neither the ITransactionCallback implementation nor the calling code needs to explicitly handle transactions.

Subclass DefaultTransactionDefinition to support setting the name of the transaction and propagation behavior.

Since:
11.1.1.3.0
See Also:
ITransactionCallback

Field Summary

 

Fields inherited from interface oracle.odi.core.persistence.transaction.ITransactionDefinition
PROPAGATION_MANDATORY, PROPAGATION_NEVER, PROPAGATION_NOT_SUPPORTED, PROPAGATION_REQUIRED, PROPAGATION_REQUIRES_NEW, PROPAGATION_SUPPORTS, TIMEOUT_DEFAULT

 

Constructor Summary
TransactionTemplate(ITransactionManager pTransactionManager)
          Construct a new TransactionTemplate using the given transaction manager.
TransactionTemplate(ITransactionManager pTransactionManager, ITransactionDefinition pDefinition)
          Construct a new TransactionTemplate using the given transaction manager.

 

Method Summary
 java.lang.Object execute(ITransactionCallback pAction)
          Execute the action specified by the given callback object within an ODI transaction.

 

Methods inherited from class oracle.odi.core.persistence.transaction.support.DefaultTransactionDefinition
getExtendedPersistentContext, getName, getPropagationBehavior, getTimeout, setExtendedEntityManager, setName, setPropagationBehavior, setTimeout

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

TransactionTemplate

public TransactionTemplate(ITransactionManager pTransactionManager)
Construct a new TransactionTemplate using the given transaction manager.
Parameters:
pTransactionManager - the transaction manager

TransactionTemplate

public TransactionTemplate(ITransactionManager pTransactionManager,
                           ITransactionDefinition pDefinition)
Construct a new TransactionTemplate using the given transaction manager.
Parameters:
pTransactionManager - the transaction manager
pDefinition - the transaction definition

Method Detail

execute

public java.lang.Object execute(ITransactionCallback pAction)
Execute the action specified by the given callback object within an ODI transaction.

Allows for returning a result object created within the transaction, that is, an ODI entity or a collection of ODI entities. A RuntimeException thrown by the callback is treated as a fatal exception that enforces a rollback. Such an exception gets propagated to the caller of the template.

Parameters:
pAction - the callback object that specifies the transactional action
Returns:
a result object returned by the callback or null

Skip navigation links

Oracle® Data Integrator Java API Reference
11g Release 1 (11.1.1.7.0)

E17060-04


Copyright © 2010, 2013, Oracle and/or its affiliates. All rights reserved.