ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Glover <robertglove...@yahoo.com>
Subject Question on using Transactions with iBatis and Spring
Date Mon, 25 Jun 2007 15:08:29 GMT
I am confused over how to use transactions with iBatis and Spring. (I'm
actually using iBatis and Abator and Spring).

   The Spring 2.0.6 manual (section 12.5) says,

    "...Transaction management can be handled through Spring's standard
facilities.  There are no special transaction strategies for iBATIS, as there
is no special transactional resource involved other than a JDBC Connection.
Hence, Spring's standard JDBC DataSourceTransactionManager or
JtaTransactionManager are perfectly sufficient. ..."

    On the other hand, page 152 of the book "iBatis in Action" by
Begin/Goddin/Meadors says:  "...Local transaction are configured in the iBatis
SQL Map configuration XML file as a JDBC transaction manager."  The iBatis book
then shows an example of using "sqlMapClient.startTractsion()",
"sqlMapClient.commitTransaction", and "sqlMapClient.endTransaction()".

    In my sql-map-config.xml I don't have any transaction related statements at
all.  In my Spring application context file I have: 

<!-- SqlMap setup for iBATIS Database Layer -->
<bean id="sqlMapClient"    
class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
    <property name="configLocation" value="WEB-INF/sql-map-config.xml"/>
    <property name="dataSource" ref="dataSource"/>
</bean>

     Can anybody add any light on using iBatis with Spring and transactions?
Note that because I use Abator (a wonderful facility) I don't write an iBatis
code at all, I just invoke the methods on the DAOs that Abator creates.

Robert




Mime
View raw message