title: How to set up transaction with myBatis and Spring
body: <p>I am trying set up transaction but without success. 
  Here is my code:</p>
  
  <pre><code>&lt;tx:annotation-driven transaction-manager="transactionManager" /&gt;
  
  &lt;bean id="dataSource" class="org.apache.ibatis.datasource.pooled.PooledDataSource"&gt;
     .......
     &lt;property name="defaultAutoCommit" value="false" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"&gt;
      &lt;property name="dataSource" ref="dataSource"/&gt;
  &lt;/bean&gt;
  
   &lt;bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"&gt;
     &lt;property name="configLocation" value="classpath:mybatis-configuration.xml" /&gt;
     &lt;property name="dataSource" ref="dataSource" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <hr>
  
  <pre><code>@Transactional
  private void prcessTransaction(...) {
   delete(...);
   //insert:
   for(Item item: itemList){
     insert(item)
   }
  }
  
  &lt;delete id="delete" parameterType="map"&gt;
      delete from .....
    &lt;/delete&gt;
  
  &lt;insert id="insert" parameterType="Item"&gt;
      insert into ....
    &lt;/insert&gt;
  </code></pre>
  
  <p>It looks like that prcessTransaction method is not only one transaction but sets of multiple transactions.</p>
  
  <p>I am using Spring 3.0.5, myBatis 3.0.4, mybatis-spring-1.0.1, Tomcat 7.0.19, Oracle     11.1.0.6.0</p>
  
  <p>Thanks for help.</p>