spring-framework / org.springframework.transaction.jta / WebSphereUowTransactionManager

WebSphereUowTransactionManager

open class WebSphereUowTransactionManager : JtaTransactionManager, CallbackPreferringPlatformTransactionManager

WebSphere-specific PlatformTransactionManager implementation that delegates to a com.ibm.wsspi.uow.UOWManager instance, obtained from WebSphere's JNDI environment. This allows Spring to leverage the full power of the WebSphere transaction coordinator, including transaction suspension, in a manner that is perfectly compliant with officially supported WebSphere API.

The CallbackPreferringPlatformTransactionManager interface implemented by this class indicates that callers should preferably pass in a TransactionCallback through the #execute method, which will be handled through the callback-based WebSphere UOWManager API instead of through standard JTA API (UserTransaction / TransactionManager). This avoids the use of the non-public javax.transaction.TransactionManager API on WebSphere, staying within supported WebSphere API boundaries.

This transaction manager implementation derives from Spring's standard JtaTransactionManager, inheriting the capability to support programmatic transaction demarcation via getTransaction / commit / rollback calls through a JTA UserTransaction handle, for callers that do not use the TransactionCallback-based #execute method. However, transaction suspension is not supported in this getTransaction style (unless you explicitly specify a #setTransactionManager reference, despite the official WebSphere recommendations). Use the #execute style for any code that might require transaction suspension.

This transaction manager is compatible with WebSphere 6.1.0.9 and above. The default JNDI location for the UOWManager is "java:comp/websphere/UOWManager". If the location happens to differ according to your WebSphere documentation, simply specify the actual location through this transaction manager's "uowManagerName" bean property.

NOTE: This JtaTransactionManager is intended to refine specific transaction demarcation behavior on Spring's side. It will happily co-exist with independently configured WebSphere transaction strategies in your persistence provider, with no need to specifically connect those setups in any way.

Author
Juergen Hoeller

Since
2.5

See Also
#setUowManager#setUowManagerNamecom.ibm.wsspi.uow.UOWManager

Constructors

<init>

WebSphereUowTransactionManager()

Create a new WebSphereUowTransactionManager.

WebSphereUowTransactionManager(uowManager: UOWManager)

Create a new WebSphereUowTransactionManager for the given UOWManager.

Properties

DEFAULT_UOW_MANAGER_NAME

static val DEFAULT_UOW_MANAGER_NAME: String

Default JNDI location for the WebSphere UOWManager.

Functions

afterPropertiesSet

open fun afterPropertiesSet(): Unit

execute

open fun <T : Any> execute(definition: TransactionDefinition, callback: TransactionCallback<T>): T

setUowManager

open fun setUowManager(uowManager: UOWManager): Unit

Set the WebSphere UOWManager to use as direct reference.

Typically just used for test setups; in a Java EE environment, the UOWManager will always be fetched from JNDI.

setUowManagerName

open fun setUowManagerName(uowManagerName: String): Unit

Set the JNDI name of the WebSphere UOWManager. The default "java:comp/websphere/UOWManager" is used if not set.

supportsResourceAdapterManagedTransactions

open fun supportsResourceAdapterManagedTransactions(): Boolean

Returns true since WebSphere ResourceAdapters (as exposed in JNDI) implicitly perform transaction enlistment if the MessageEndpointFactory's isDeliveryTransacted method returns true. In that case we'll simply skip the #createTransaction call.