Here is my config file for Spring. It uses transaction with annotation. @Transactional can be put before method or class declaration to make the method/class transactional. (see Spring documentation for more details).
<!-- Transaction handling --> <tx:annotation-driven transaction-manager="txManager"/> <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager" > <property name="dataSource" ref="dataSource"/> </bean> <!-- Initialize iBATIS --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${driver}"/> <property name="url" value="${url}"/> <property name="username" value="${username}"/> <property name="password" value="${password}"/> </bean> <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"> <property name="configLocation" value="classpath:ca/qc/ircm/proteus/persistence/dao/sqlmap/sql/sql-map-c onfig.xml"/> <property name="dataSource" ref="dataSource"/> </bean> <!-- Initialize DAOs --> <bean id="aliasGroupDao" class="ca.qc.ircm.proteus.persistence.dao.sqlmap.AliasGroupSqlMapDao"> <property name="sqlMapClient" ref="sqlMapClient"/> </bean> I have to say that it would be really nice to have an "how to" for passing from iBATIS DAO to Spring DAO... I made a french document about that question. I could transalte it to english in the next weeks and put it on the wiki... Christian -----Original Message----- From: Meindert [mailto:[EMAIL PROTECTED] Sent: Tuesday, 10 April 2007 04:52 To: user-java@ibatis.apache.org Subject: RE: iBATIS, Spring, and transactions... Hi All, Does anybody have an answer on the question posted below? I want to switch of from IBATIS DAO to spring because IBATIS DAO is depreciated. I can convert most of the code quite simply, but what must I do with my transactions? Kind Regards Meindert -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 03 April 2007 07:15 PM To: user-java@ibatis.apache.org Subject: iBATIS, Spring, and transactions... Hi, Another newbie question. If I am implementing DAOs using Spring's iBATIS support, am I required to also use Spring's transaction controls, or can I still use the startTransaction(), commitTransaction() and endTransaction() calls supplied by iBATIS? If I can, I'm afraid that it's not clear to me how to specify that I want to do this in the relevant XML configuration files. Thanks, Brendan