2016-11-07 101 views
1

我正在使用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一樣?

回答

1

您可以在數據源的設置中設置自動提交(defaultAutoCommit)。

1

駱駝SQL組件使用Spring的JDBC支持,所以唯一的方法(我知道)將標記爲transacted - 這樣一旦整個路由完成就會發生提交。