public class

OC4JJtaTransactionManager

extends JtaTransactionManager
java.lang.Object
   ↳ org.springframework.transaction.support.AbstractPlatformTransactionManager
     ↳ org.springframework.transaction.jta.JtaTransactionManager
       ↳ org.springframework.transaction.jta.OC4JJtaTransactionManager

Class Overview

Special JtaTransactionManager variant for Oracle OC4J (10.1.3 and higher). Supports the full power of Spring's transaction definitions on OC4J's transaction coordinator, beyond standard JTA: transaction names and per-transaction isolation levels.

Uses OC4J's special begin(name) method to start a JTA transaction, in orderto make Spring-driven transactions visible in OC4J's transaction monitor. In case of Spring's declarative transactions, the exposed name will (by default) be the fully-qualified class name + "." + method name.

Supports a per-transaction isolation level through OC4J's corresponding OC4JTransaction.setTransactionIsolation(int) method. This will apply the specified isolation level (e.g. ISOLATION_SERIALIZABLE) to all JDBC Connections that participate in the given transaction.

Automatically detects the available OC4J server version and adapts accordingly. Supports the "com.evermind.server" package in OC4J 10.1.3.2 as well as the "oracle.j2ee.transaction" package in later OC4J versions.

By default, the JTA UserTransaction and TransactionManager handles are fetched directly from OC4J's TransactionUtility in 10.1.3.2+. This can be overridden by specifying "userTransaction"/"userTransactionName" and "transactionManager"/"transactionManagerName", passing in existing handles or specifying corresponding JNDI locations to look up.

Thanks to Oracle for donating the original version of this extended OC4J integration code to the Spring project!

See Also
  • getName()
  • getIsolationLevel()
  • oracle.j2ee.transaction.OC4JTransactionManager#begin(String)
  • oracle.j2ee.transaction.OC4JTransaction#setTransactionIsolation
  • oracle.j2ee.transaction.TransactionUtility

Summary

[Expand]
Inherited Constants
From class org.springframework.transaction.jta.JtaTransactionManager
From class org.springframework.transaction.support.AbstractPlatformTransactionManager
[Expand]
Inherited Fields
From class org.springframework.transaction.jta.JtaTransactionManager
From class org.springframework.transaction.support.AbstractPlatformTransactionManager
Public Constructors
OC4JJtaTransactionManager()
Public Methods
void afterPropertiesSet()
Initialize the UserTransaction as well as the TransactionManager handle.
Transaction createTransaction(String name, int timeout)
Create an active Transaction object based on the given name and timeout.
Protected Methods
void doJtaBegin(JtaTransactionObject txObject, TransactionDefinition definition)
Perform a JTA begin on the JTA UserTransaction or TransactionManager.
UserTransaction retrieveUserTransaction()
Allows subclasses to retrieve the JTA UserTransaction in a vendor-specific manner.
[Expand]
Inherited Methods
From class org.springframework.transaction.jta.JtaTransactionManager
From class org.springframework.transaction.support.AbstractPlatformTransactionManager
From class java.lang.Object
From interface org.springframework.beans.factory.InitializingBean
From interface org.springframework.transaction.PlatformTransactionManager
From interface org.springframework.transaction.jta.TransactionFactory

Public Constructors

public OC4JJtaTransactionManager ()

Public Methods

public void afterPropertiesSet ()

Initialize the UserTransaction as well as the TransactionManager handle.

public Transaction createTransaction (String name, int timeout)

Create an active Transaction object based on the given name and timeout.

Parameters
name the transaction name (may be null)
timeout the transaction timeout (may be -1 for the default timeout)
Returns
  • the active Transaction object (never null)
Throws
NotSupportedException
SystemException

Protected Methods

protected void doJtaBegin (JtaTransactionObject txObject, TransactionDefinition definition)

Perform a JTA begin on the JTA UserTransaction or TransactionManager.

This implementation only supports standard JTA functionality: that is, no per-transaction isolation levels and no transaction names. Can be overridden in subclasses, for specific JTA implementations.

Calls applyIsolationLevel and applyTimeout before invoking the UserTransaction's begin method.

Parameters
txObject the JtaTransactionObject containing the UserTransaction
definition TransactionDefinition instance, describing propagation behavior, isolation level, read-only flag, timeout, and transaction name
Throws
NotSupportedException
SystemException

protected UserTransaction retrieveUserTransaction ()

Allows subclasses to retrieve the JTA UserTransaction in a vendor-specific manner. Only called if no "userTransaction" or "userTransactionName" specified.

The default implementation simply returns null.

Returns
  • the JTA UserTransaction handle to use, or null if none found