How to enable custom isolation levels for JTA Transaction Manager in Spring

Question

How to configure a JtaTransactionManager object with allowCustomIsolationLevels set to true using Spring so that Spring configuration can be used on multiple application servers?

Background:

I have an application that is currently ending with JBossAS and I am trying to run it in WebSphere. The only problem I'm currently facing is getting the right JTA Transaction Manager with the appropriate settings.

Here is the old setting

<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="transactionManagerName"> <value>java:/TransactionManager</value> </property> <property name="allowCustomIsolationLevels" value="true" /> </bean> 

This worked because JBossAS has a JTA Transaction Manager defined in the JNDI location java: / TransactionManager. However, WebSphere does not have the same JNDI location.

Spring 2.5.x provides a way to get JTA Transaction Manager in a generic way.

 <tx:jta-transaction-manager /> 

This gets the JtaTransactionManager object and defines it as a bean with transactionManager identifier.

I looked at the Spring TX diagram, but the only option available is to set a specific level of isolation, but not just for the custom levels to be used (as defined elsewhere). How to set allowCustomIsolationLevels property using tx tag: jta-transaction-manager?

+4
source share
1 answer

Transaction Managers and Websphere:

Websphere does not use the standard jndi standard when shipping a transaction manager. Spring worked on this by providing org.springframework.transaction.jta.WebSphereUowTransactionManager, which you can use to search for websphere transaction manager.

Data Levels and Isolation Levels

Usually you cannot change the isolation level of the data source, and I know that you cannot change it when connecting from the websphere database to DB2 (it is specified as a parameter in the configuration of the data source). The allowCustomIsolationLevels flag allows you to select different data sources for different isolation levels.

Look here and here

+2
source

All Articles