tags:

views:

35

answers:

1

Question

How do I configure a JtaTransactionManager object with allowCustomIsolationLevels set to true via Spring such that the Spring configuration can be used across multiple application servers?

Background:

I have an application that is currently running out of JBossAS and I'm trying to get it to run in WebSphere. The only issue I'm currently having is getting the correct JTA Transaction Manager injected with the proper settings.

Here's 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 since JBossAS has it's JTA Transaction Manager defined at JNDI location java:/TransactionManager. However, WebSphere does not have the same JNDI location.

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

<tx:jta-transaction-manager />

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

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

+1  A: 

Transaction Managers and Websphere:

Websphere does not use the typical jndi standard when supplying the transaction manager. Spring has worked around this by providing the org.springframework.transaction.jta.WebSphereUowTransactionManager that you can use to lookup the websphere transaction manager.

Datasource and Isolation Levels

You typically cannot change the isolation level of a datasource and I know you cannot change it when connecting from websphere to DB2 database (it's set as a parameter on the datasource configuration). The allowCustomIsolationLevels flag lets you select different data sources for different requested isolation levels..

See here and here

Michael Wiles