ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Volkmann <m...@ociweb.com>
Subject Re: XA transactions
Date Fri, 20 Apr 2007 14:22:17 GMT
On Apr 20, 2007, at 9:06 AM, Chris Lamey wrote:
> Do you want to use Spring for everything?
>   If so, then you don't need to do anything iBATIS-wise if your  
> transaction setup is already done.  You will need to read the  
> Spring docs on XA transaction management, but it'll be transparent  
> to iBATIS.  If you don't want to use Spring, then you need to  
> configure the transactionmanager on the SqlMapClient bean itself.
So if I'm using Spring to manage transactions then I don't need a  
transactionManager element in my SqlMapConfig.xml at all? I thought I  
at least needed to include that to tell iBATIS that I was using an  
"EXTERNAL" transaction manager.
>   I'm pretty sure the transactionmanager element in the sqlmap  
> config file is effectively ignored if you're using the Spring  
> SqlMapClient (it's overridden Spring, which defaults to EXTERNAL so  
> Spring can manage the txns by default).
Ahh ... I guess that default gives me the answer to my previous  

I am using org.springframework.orm.ibatis.SqlMapClientFactoryBean.  
Here's the setup in my spring-beans.xml file for the two databases  
I'm accessing.

   <bean id="oracleDataSource"
     <property name="jndiName" value="java:jdbc/GWT_Test_OracleDB"/>

   <bean id="sqlServerDataSource"
     <property name="jndiName" value="java:jdbc/GWT_Test_SqlServerDB"/>

   <bean id="oracleSqlMapClient"
     <property name="configLocation" value="/WEB-INF/ 
     <property name="dataSource" ref="oracleDataSource"/>

   <bean id="sqlServerSqlMapClient"
     <property name="configLocation" value="/WEB-INF/ 
     <property name="dataSource" ref="sqlServerDataSource"/>

Does this look okay?
>   Even in this case, I'd recommend that you use Spring to pull in  
> the JBoss manager via JNDI as the transaction manager or something  
> rather than configuring iBATIS directly.
Like this?

   <bean id="transactionManager"
     <property name="transactionManagerName" value="java:/ 
   <tx:annotation-driven transaction-manager="transactionManager"/>

> -----Original Message-----
> From: Mark Volkmann [mailto:mark@ociweb.com]
> Sent: Fri 4/20/2007 7:14 AM
> To: user-java@ibatis.apache.org
> Subject: XA transactions
> I'm using JBoss, Spring transactions, iBATIS and Spring DAOs
> generated by Abator. I need to global transactions that span
> operations in two databases. When I specify the <transactionManager>
> element in my SqlMapConfig.xml file, should I use type="JTA" where
> iBATIS will actively manage transactions or type="EXTERNAL" where
> iBATIS will allow Spring to manage transactions?

View raw message