Class WebLogicJtaTransactionManager
- All Implemented Interfaces:
Serializable, InitializingBean, ConfigurableTransactionManager, TransactionFactory, PlatformTransactionManager, TransactionManager
JtaTransactionManager variant for Oracle WebLogic 15.1.1 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.
Note: This class was initially removed as of Spring Framework 6.0 but then
brought back after the WebLogic 15.1.1 release which finally delivers Jakarta EE 9
compatibility. As of Spring Framework 6.2.16, it is available again for manual
configuration - as a replacement for the standard JtaTransactionManager.
- Since:
- 6.2.16
- Author:
- Juergen Hoeller
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractPlatformTransactionManager
AbstractPlatformTransactionManager.SuspendedResourcesHolder -
Field Summary
Fields inherited from class JtaTransactionManager
DEFAULT_TRANSACTION_SYNCHRONIZATION_REGISTRY_NAME, DEFAULT_USER_TRANSACTION_NAME, FALLBACK_TRANSACTION_MANAGER_NAMESFields inherited from class AbstractPlatformTransactionManager
logger, SYNCHRONIZATION_ALWAYS, SYNCHRONIZATION_NEVER, SYNCHRONIZATION_ON_ACTUAL_TRANSACTION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInitialize the UserTransaction as well as the TransactionManager handle.jakarta.transaction.TransactioncreateTransaction(@Nullable String name, int timeout) Create an active Transaction object based on the given name and timeout.protected voiddoJtaBegin(JtaTransactionObject txObject, TransactionDefinition definition) Perform a JTA begin on the JTA UserTransaction or TransactionManager.protected voiddoJtaResume(@Nullable JtaTransactionObject txObject, Object suspendedTransaction) Perform a JTA resume on the JTA TransactionManager.protected @Nullable jakarta.transaction.TransactionManagerAllows subclasses to retrieve the JTA TransactionManager in a vendor-specific manner.protected @Nullable jakarta.transaction.UserTransactionAllows subclasses to retrieve the JTA UserTransaction in a vendor-specific manner.Methods inherited from class JtaTransactionManager
applyIsolationLevel, applyTimeout, buildUserTransaction, checkUserTransactionAndTransactionManager, doBegin, doCleanupAfterCompletion, doCommit, doGetJtaTransaction, doGetTransaction, doJtaSuspend, doRegisterAfterCompletionWithJtaTransaction, doResume, doRollback, doSetRollbackOnly, doSuspend, findTransactionManager, findTransactionSynchronizationRegistry, findUserTransaction, getJndiEnvironment, getJndiTemplate, getTransactionManager, getTransactionSynchronizationRegistry, getUserTransaction, initTransactionSynchronizationRegistry, initUserTransactionAndTransactionManager, isExistingTransaction, lookupTransactionManager, lookupTransactionSynchronizationRegistry, lookupUserTransaction, registerAfterCompletionWithExistingTransaction, retrieveTransactionSynchronizationRegistry, setAllowCustomIsolationLevels, setAutodetectTransactionManager, setAutodetectTransactionSynchronizationRegistry, setAutodetectUserTransaction, setCacheUserTransaction, setJndiEnvironment, setJndiTemplate, setTransactionManager, setTransactionManagerName, setTransactionSynchronizationRegistry, setTransactionSynchronizationRegistryName, setUserTransaction, setUserTransactionName, shouldCommitOnGlobalRollbackOnly, supportsResourceAdapterManagedTransactions, useSavepointForNestedTransactionMethods inherited from class AbstractPlatformTransactionManager
commit, determineTimeout, getDefaultTimeout, getTransaction, getTransactionExecutionListeners, getTransactionSynchronization, invokeAfterCompletion, isFailEarlyOnGlobalRollbackOnly, isGlobalRollbackOnParticipationFailure, isNestedTransactionAllowed, isRollbackOnCommitFailure, isValidateExistingTransaction, prepareForCommit, prepareSynchronization, resume, rollback, setDefaultTimeout, setFailEarlyOnGlobalRollbackOnly, setGlobalRollbackOnParticipationFailure, setNestedTransactionAllowed, setRollbackOnCommitFailure, setTransactionExecutionListeners, setTransactionSynchronization, setTransactionSynchronizationName, setValidateExistingTransaction, suspend, triggerBeforeCommit, triggerBeforeCompletionMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ConfigurableTransactionManager
addListener
-
Constructor Details
-
WebLogicJtaTransactionManager
public WebLogicJtaTransactionManager()
-
-
Method Details
-
afterPropertiesSet
Description copied from class:JtaTransactionManagerInitialize the UserTransaction as well as the TransactionManager handle.- Specified by:
afterPropertiesSetin interfaceInitializingBean- Overrides:
afterPropertiesSetin classJtaTransactionManager- Throws:
TransactionSystemException- See Also:
-
retrieveUserTransaction
protected @Nullable jakarta.transaction.UserTransaction retrieveUserTransaction() throws TransactionSystemExceptionDescription copied from class:JtaTransactionManagerAllows 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.- Overrides:
retrieveUserTransactionin classJtaTransactionManager- Returns:
- the JTA UserTransaction handle to use, or
nullif none found - Throws:
TransactionSystemException- in case of errors- See Also:
-
retrieveTransactionManager
protected @Nullable jakarta.transaction.TransactionManager retrieveTransactionManager() throws TransactionSystemExceptionDescription copied from class:JtaTransactionManagerAllows 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.- Overrides:
retrieveTransactionManagerin classJtaTransactionManager- Returns:
- the JTA TransactionManager handle to use, or
nullif none found - Throws:
TransactionSystemException- in case of errors- See Also:
-
doJtaBegin
protected void doJtaBegin(JtaTransactionObject txObject, TransactionDefinition definition) throws jakarta.transaction.NotSupportedException, jakarta.transaction.SystemException Description copied from class:JtaTransactionManagerPerform 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
applyIsolationLevelandapplyTimeoutbefore invoking the UserTransaction'sbeginmethod.- Overrides:
doJtaBeginin classJtaTransactionManager- Parameters:
txObject- the JtaTransactionObject containing the UserTransactiondefinition- the TransactionDefinition instance, describing propagation behavior, isolation level, read-only flag, timeout, and transaction name- Throws:
jakarta.transaction.NotSupportedException- if thrown by JTA methodsjakarta.transaction.SystemException- if thrown by JTA methods- See Also:
-
doJtaResume
protected void doJtaResume(@Nullable JtaTransactionObject txObject, Object suspendedTransaction) throws jakarta.transaction.InvalidTransactionException, jakarta.transaction.SystemException Description copied from class:JtaTransactionManagerPerform a JTA resume on the JTA TransactionManager.Can be overridden in subclasses, for specific JTA implementations.
- Overrides:
doJtaResumein classJtaTransactionManager- Parameters:
txObject- the JtaTransactionObject containing the UserTransactionsuspendedTransaction- the suspended JTA Transaction object- Throws:
jakarta.transaction.InvalidTransactionException- if thrown by JTA methodsjakarta.transaction.SystemException- if thrown by JTA methods- See Also:
-
createTransaction
public jakarta.transaction.Transaction createTransaction(@Nullable String name, int timeout) throws jakarta.transaction.NotSupportedException, jakarta.transaction.SystemException Description copied from interface:TransactionFactoryCreate an active Transaction object based on the given name and timeout.- Specified by:
createTransactionin interfaceTransactionFactory- Overrides:
createTransactionin classJtaTransactionManager- Parameters:
name- the transaction name (may benull)timeout- the transaction timeout (may be -1 for the default timeout)- Returns:
- the active Transaction object (never
null) - Throws:
jakarta.transaction.NotSupportedException- if the transaction manager does not support a transaction of the specified typejakarta.transaction.SystemException- if the transaction manager failed to create the transaction
-