Hi,
I am using Spring Programmatic transaction in the service layer and service
layer calls IBatisDAO(sqlMapClientTemplate) to insert/update.
Transaction Rollback and commit works fine.
But if i introduce any new layer between Service and IBatisDAO the
transaction rollback is not working...
Here is the code sniplet.
DefaultTransactionDefinition def = new
DefaultTransactionDefinition();
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
TransactionStatus status = txManager.getTransaction(def);
try{
ibatisDAO.process(dataMap, processorId); //This is direct
call to ibatisDAO and transaction process works fine.
//ibatisDAOProcessor.process(dataMap); // This is another
layer between Service and IbatisDAO.transaction rollback doesnt work.
}catch(MultipleErrorsException me){
txManager.commit(status);
}
txManager.commit(status);
Spring config
------------------------------
<bean name="txManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource">
<ref bean="inetDs"/>
</property>
</bean>
<bean id="sqlMap"
class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation">
<value>sqlMapConfig.xml</value>
</property>
<property name="dataSource">
<ref bean="datasource"/>
</property>
<property name="useTransactionAwareDataSource">
<value>true</value>
</property>
<property name="transactionConfigClass">
<value>com.ibatis.sqlmap.engine.transaction.external.ExternalTransactionConfig</value>
</property>
<property name="transactionConfigProperties">
<props>
<prop key="DefaultAutoCommit">false</prop>
</props>
</property>
</bean>
Thanks in Advance..