1

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?

Magoo
  • 77,302
  • 8
  • 62
  • 84
KayV
  • 12,987
  • 11
  • 98
  • 148

2 Answers2

2

Camel SQL component uses Spring's JDBC support so the only way to do it (that I know of) would be marking the route as transacted - that way the commit would occur once the whole route has completed.

Miloš Milivojević
  • 5,219
  • 3
  • 26
  • 39
0

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

Alexey Yakunin
  • 1,743
  • 1
  • 19
  • 21