java.lang.Object | |||
↳ | org.springframework.transaction.support.AbstractPlatformTransactionManager | ||
↳ | org.springframework.transaction.jta.JtaTransactionManager | ||
↳ | org.springframework.transaction.jta.WebSphereUowTransactionManager |
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(TransactionDefinition, TransactionCallback
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(TransactionDefinition, TransactionCallback
method. However,
transaction suspension is not supported in this getTransaction
style (unless you explicitly specify a setTransactionManager(TransactionManager)
reference,
despite the official WebSphere recommendations). Use the execute(TransactionDefinition, TransactionCallback
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.
setUowManager(UOWManager)
setUowManagerName(String)
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | DEFAULT_UOW_MANAGER_NAME | Default JNDI location for the WebSphere UOWManager. |
[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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a new WebSphereUowTransactionManager.
| |||||||||||
Create a new WebSphereUowTransactionManager for the given UOWManager.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Initialize the UserTransaction as well as the TransactionManager handle.
| |||||||||||
Execute the action specified by the given callback object within a transaction.
| |||||||||||
Set the WebSphere UOWManager to use as direct reference.
| |||||||||||
Set the JNDI name of the WebSphere UOWManager.
| |||||||||||
Returns
true since WebSphere ResourceAdapters (as exposed in JNDI)
implicitly perform transaction enlistment if the MessageEndpointFactory's
isDeliveryTransacted method returns true . |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Registers the synchronizations as interposed JTA Synchronization on the UOWManager.
| |||||||||||
Obtain the WebSphere UOWManager from the default JNDI location
"java:comp/websphere/UOWManager".
| |||||||||||
Look up the WebSphere UOWManager in JNDI via the configured name.
|
[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
| |||||||||||
From interface
org.springframework.transaction.support.CallbackPreferringPlatformTransactionManager
|
Default JNDI location for the WebSphere UOWManager.
Create a new WebSphereUowTransactionManager.
Create a new WebSphereUowTransactionManager for the given UOWManager.
uowManager | the WebSphere UOWManager to use as direct reference |
---|
Initialize the UserTransaction as well as the TransactionManager handle.
TransactionSystemException |
---|
Execute the action specified by the given callback object within a transaction.
Allows for returning a result object created within the transaction, that is, a domain object or a collection of domain objects. 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.
definition | the definition for the transaction to wrap the callback in |
---|---|
callback | the callback object that specifies the transactional action |
null
if noneTransactionException |
---|
Set the WebSphere UOWManager to use as direct reference.
Typically just used for test setups; in a J2EE environment, the UOWManager will always be fetched from JNDI.
Set the JNDI name of the WebSphere UOWManager. The default "java:comp/websphere/UOWManager" is used if not set.
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(String, int)
call.
AbstractMessageEndpointFactory
createTransaction(String, int)
Registers the synchronizations as interposed JTA Synchronization on the UOWManager.
txObject | the current transaction object |
---|---|
synchronizations | List of TransactionSynchronization objects |
Obtain the WebSphere UOWManager from the default JNDI location "java:comp/websphere/UOWManager".
TransactionSystemException | if the JNDI lookup failed |
---|
Look up the WebSphere UOWManager in JNDI via the configured name.
uowManagerName | the JNDI name of the UOWManager |
---|
TransactionSystemException | if the JNDI lookup failed |
---|