public class

WebLogicJtaTransactionManager

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

Class Overview

Special JtaTransactionManager variant for BEA WebLogic (9.0 and higher). Supports the full power of Spring's transaction definitions on WebLogic's transaction coordinator, beyond standard JTA: transaction names, per-transaction isolation levels, and proper resuming of transactions in all cases.

Uses WebLogic's special begin(name) method to start a JTA transaction, in order to make Spring-driven transactions visible in WebLogic'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 WebLogic's corresponding JTA transaction property "ISOLATION LEVEL". This will apply the specified isolation level (e.g. ISOLATION_SERIALIZABLE) to all JDBC Connections that participate in the given transaction.

Invokes WebLogic's special forceResume method if standard JTA resume failed, to also resume if the target transaction was marked rollback-only. If you're not relying on this feature of transaction suspension in the first place, Spring's standard JtaTransactionManager will behave properly too.

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

See Also
  • getName()
  • getIsolationLevel()
  • weblogic.transaction.UserTransaction#begin(String)
  • weblogic.transaction.Transaction#setProperty
  • weblogic.transaction.TransactionManager#forceResume
  • weblogic.transaction.TransactionHelper

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
WebLogicJtaTransactionManager()
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.
void doJtaResume(JtaTransactionObject txObject, Object suspendedTransaction)
Perform a JTA resume on the JTA TransactionManager.
TransactionManager retrieveTransactionManager()
Allows subclasses to retrieve the JTA TransactionManager in a vendor-specific manner.
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 WebLogicJtaTransactionManager ()

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 void doJtaResume (JtaTransactionObject txObject, Object suspendedTransaction)

Perform a JTA resume on the JTA TransactionManager.

Can be overridden in subclasses, for specific JTA implementations.

Parameters
txObject the JtaTransactionObject containing the UserTransaction
suspendedTransaction the suspended JTA Transaction object
Throws
InvalidTransactionException
SystemException

protected TransactionManager retrieveTransactionManager ()

Allows subclasses to retrieve the JTA TransactionManager in a vendor-specific manner. Only called if no "transactionManager" or "transactionManagerName" specified.

The default implementation simply returns null.

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

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