title: Mule ESB 3 Transactional Flow Single Jdbc Resource Not Rolling Back (MSSQL & jtds)
body: <p><strong>EDIT</strong>: This only happens with MSSQL &amp; jtds 1.2.6  Still investigating...<br>
  **Duplicate of : <a href="https://stackoverflow.com/questions/12421936/mule-3-3-0-jdbc-transaction-undesired-commit">Mule 3.3.0 Jdbc Transaction Undesired Commit</a><br>
  **Mule Documentation sucks.  </p>
  
  <p>I want to rollback everything inside a flow that has several database endpoints.<br>
  I have a single JDBC datasource resource (i.e. no need for fancy XA, 2PC, etc).<br>
  I have managed to configure Mule to, at least, not complain that no Transaction Manager is configured, etc.... but: It doesn't work; i.e it does not rollback the transaction when an exception occurs.<br>
  Since I'm running Mule standalone, I don't have fancy weblogic, jboss, etc transactionmanagers so I thought I could use Spring's DataSourceTransactionManager.  What other choice I have for this?</p>
  
  <p>Here is my flow (flow1 is just for triggering flow2, wich is the one I want to be transactional):  </p>
  
  <p><img src="https://i.stack.imgur.com/f1gwJ.png" alt="Flow"></p>
  
  <p>And the XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;mule version="CE-3.3.0"&gt;
      &lt;spring:beans&gt;
          &lt;spring:bean id="transactionManager"
              class="org.springframework.jdbc.datasource.DataSourceTransactionManager"&gt;
              &lt;spring:property name="dataSource" ref="dataSource" /&gt;
          &lt;/spring:bean&gt;
  
          &lt;spring:bean id="transactionFactory"
              class="org.mule.module.spring.transaction.SpringTransactionFactory"&gt;
              &lt;spring:property name="manager" ref="transactionManager" /&gt;
          &lt;/spring:bean&gt;
  
          &lt;spring:bean id="dataSource" name="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
              &lt;spring:property name="driverClassName" value="com.mysql.jdbc.Driver"/&gt;
              &lt;spring:property name="url" value="jdbc:mysql://localhost/mydb"/&gt;
              &lt;spring:property name="username" value="sa"/&gt;
              &lt;spring:property name="password" value=""/&gt;
          &lt;/spring:bean&gt;    
      &lt;/spring:beans&gt;
  
      &lt;jdbc:connector name="jdbcConnector" dataSource-ref="dataSource"
          transactionPerMessage="true" queryTimeout="20000" pollingFrequency="10000"
          doc:name="Database" validateConnections="false"&gt;&lt;/jdbc:connector&gt;
      &lt;flow name="flow1" doc:name="flow1"&gt;
          &lt;http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/&gt;
          &lt;vm:outbound-endpoint exchange-pattern="request-response" path="toFlow2" doc:name="VM"/&gt;
      &lt;/flow&gt;
      &lt;flow name="flow2" doc:name="flow2"&gt;
          &lt;vm:inbound-endpoint exchange-pattern="request-response" path="toFlow2" doc:name="VM"&gt;
          &lt;custom-transaction factory-ref="transactionFactory" action="ALWAYS_BEGIN" timeout="10"/&gt;
      &lt;/vm:inbound-endpoint&gt;
          &lt;jdbc:outbound-endpoint exchange-pattern="request-response" queryKey="query1" queryTimeout="-1" connector-ref="jdbcConnector" doc:name="Database"&gt;
              &lt;jdbc:query key="query1" value="insert into Foo (field1) values ('bar')"/&gt;
              &lt;jdbc:transaction action="ALWAYS_JOIN"/&gt;
          &lt;/jdbc:outbound-endpoint&gt;
          &lt;jdbc:outbound-endpoint exchange-pattern="request-response" queryKey="query2" queryTimeout="-1" connector-ref="jdbcConnector" doc:name="Database"&gt;
              &lt;jdbc:query key="query2" value="insert into Bar (field1) values ('foo')"/&gt;
              &lt;jdbc:transaction action="ALWAYS_JOIN"/&gt;
          &lt;/jdbc:outbound-endpoint&gt;
      &lt;/flow&gt;
  
  &lt;/mule&gt;
  </code></pre>
  
  <p>Not shown here, I also have a default exception catch strategy, that simply writes the faulty payload to a file.  I don't know if I need to do a rollback explicitly, but I didn't find how.</p>
  
  <p>Any help would be much appreciated.</p>