如何在apache camel sql批量插入中设置autocommit false?

如何在apache camel sql批量插入中设置autocommit false?

问题描述:

我正在使用apache-camel sql-batch插入。 我对SQL批处理插入路线如下:如何在apache camel sql批量插入中设置autocommit false?

<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> 

我想配置自动提交虚假的这条路线。 有人能帮我解决这个问题吗? 仅供参考...当我使用mybatis进行批量插入时,mybatis框架将autocommit设置为false。我怎样才能使用飞机SQL一样?

您可以在数据源的设置中设置自动提交(defaultAutoCommit)。

骆驼SQL组件使用Spring的JDBC支持,所以唯一的方法(我知道)将标记为transacted - 这样一旦整个路由完成就会发生提交。