Question
如何通过Spring将allowCustomIsolationLevels设置为true来配置JtaTransactionManager对象,以便可以跨多个应用程序服务器使用Spring配置?
Background:
我有一个当前用完JBossAS的应用程序,我试图让它在WebSphere中运行 . 我目前唯一的问题是使用正确的设置注入正确的JTA事务管理器 .
这是旧的设置
<bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManagerName">
<value>java:/TransactionManager</value>
</property>
<property name="allowCustomIsolationLevels" value="true" />
</bean>
这是有效的,因为JBossAS在JNDI位置java:/ TransactionManager中定义了JTA事务管理器 . 但是,WebSphere没有相同的JNDI位置 .
Spring 2.5.x提供了一种以通用方式获取JTA事务管理器的方法 .
<tx:jta-transaction-manager />
这将获取JtaTransactionManager对象并将其定义为具有id transactionManager的bean .
我查看了Spring TX schema,但唯一可用的设置是设置特定的隔离级别,但不仅仅是允许使用自定义级别(如其他地方所定义) . How do I set the allowCustomIsolationLevels property using the tx:jta-transaction-manager tag?
1 回答
Transaction Managers and Websphere:
提供事务管理器时,Websphere不使用典型的jndi标准 . Spring通过提供可用于查找websphere事务管理器的org.springframework.transaction.jta.WebSphereUowTransactionManager来解决这个问题 .
Datasource and Isolation Levels
您通常无法更改数据源的隔离级别,并且我知道在从websphere连接到DB2数据库时(在数据源配置中将其设置为参数),您无法更改它 . allowCustomIsolationLevels标志允许您为不同的请求隔离级别选择不同的数据源 .
见here和here