ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Lamey <cla...@localmatters.com>
Subject Re: transactions with Spring DAOs
Date Wed, 14 Mar 2007 14:50:13 GMT
I'd highly recommend using Spring's declarative transactions over
manually handling them in your code.  The big benefit is that you can
string calls together in a single transaction without having to pass
transactions/connections/whatever around in your methods.  Plus your
code is cleaner because there's no transaction code involved.  It is a
little weird at first to "give up" control in the code, but it's very
cool when you see it working.

I wrote up a quick example in a thread on this list with a subject of
"Transaction issue with 2.2.0", if you want an example.

As for why the Spring SqlMapClient seems to be ignoring the SIMPLE/JDBC
iBATIS config, it might be that the SqlMapClient is using a DataSource
defined in Spring and not the iBATIS one?  What does the bean element
that defines the SqlMapClient look like?

On Wed, 2007-03-14 at 09:01 -0500, Mark Volkmann wrote:
> I wrote some JDBC code this morning to verify that the version of  
> MySQL I'm using and the driver I'm using is handling transactions  
> correctly and it is.
> 
> That brings me back to Spring DAOs generated by Abator. I'm convinced  
> that simply calling the SqlMapClient startTransaction method does not  
> disable MySQL auto-commit. I must need to do something else to  
> disable that, but I don't know what.
> 
> I'll look into using Spring declarative transactions and see if that  
> works, but I'd really like a solution using SqlMapClient  
> startTransaction.
> 

Mime
View raw message