javaapache-camelbatch-processingcamel-sql

How to set autocommit false in apache camel sql batch insertion?


I am using apache-camel sql-batch insertion. My route for sql batch insertion is as follows:

<pipeline>
   <transform>
      <method ref="insertionMyBean" method="myBatchInsertion"></method>
   </transform>
   <choice>
       <when>
           <simple>${in.header.myCount} == ${properties:batch.mySize}</simple>
           <to uri="sql:{{sql.subs.insertMyBatchStatement}}?batch=true"></to>
           <log message="Inserted rows ${body}"></log>
       </when>
   </choice>
</pipeline>

I want to configure autocommit false for this route. Can anybody help me out with this? FYI...When i use mybatis for batch insertion, autocommit is set false by the mybatis framework. How can i do the same when using plane sql?


Solution

  • You can set autocommit in settings of data source (defaultAutoCommit).