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: Transaction Control across multiple datasources
Date Thu, 29 Mar 2007 15:24:40 GMT
On Mar 29, 2007, at 9:23 AM, Seth Helstrip wrote:

> I'm relatively new to iBatis and am hoping someone can
> offer me some form of transaction management advise?
>
> I'm using Spring MVC with iBatis, and so far, have
> been mightily impressed with both technologies.
> Within my application I have the need to maintain
> transactions across two datasources and daoconfig,
> each pointing at a different db implementation - one
> Oracle, one DB2.
>
> Since I'm using Spring I was wondering whether the
> best way to do this would be to use EXTERNAL
> transaction management within iBatis and to somehow
> span the two DAO activities using a Spring transaction
> mechanism.
>
> I'm not using Spring IoC - and as such, think this
> approach may require some messy coding.
>
> Any advise will be greatly appreciated.

I'm doing almost exactly the same thing as you. The only difference  
is that we are using Google Web Toolkit instead of Spring MVC. We're  
using Spring DAOs generated using Abator and plan to use Spring  
declarative transaction management as described in section 9.5 of the  
Spring reference manual. The great thing about this approach is that  
you just have to mark methods that should be run in a transaction  
with the @Transactional annotation and you're done! One thing I need  
to verify is that when one @Transactional method invokes another, the  
second one doesn't start a new transaction and the annotation is  
essentially ignore. I hope that's the behavior.

The key part of this seems to be the setup in context.xml that they  
describe in section 9.5.2. Check out the <tx:advice> and <aop:config>  
elements. We have this working with Oracle and DB2 now, but haven't  
yet setup a demo to show that we can have a transaction that spans  
both databases. Hopefully we will have that working in another week.  
We are going to attempt to get this to work with the transaction  
manager that is provided with JBoss and may also test out Atomikos  
Transactions later.


Mime
View raw message