私は私のプロジェクトでラクダMyBatisのコンポーネントを使用する場合、私はそのリストのパラメータは、 'リスト' を指定する必要があります見つけcamel mybatisコンポーネントは、 'list'という名前のリストパラメータのみをサポートしていますか?
以下の例では動作します:
from(xxx)
...
...
.setHeader("list",simple("${body.OriginCodeList}"))
.to("mybatis:selectByInnerCodeList?statementType=SelectList&inputHeader=list")
MyBatisのマッパーXMLを:
<select id="selectByInnerCodeList" resultMap="BaseResultMap" parameterType="java.util.List">
select
<include refid="Base_Column_List" />
from MF_FundManagerNew
WHERE Incumbent=1
<if test="list!=null and list.size()>0 ">
and InnerCode IN
<foreach collection="list" item="innerCodeSingle" open="(" close=")" separator=",">
#{innerCodeSingle}
</foreach>
</if>
</select>
成功
このルートは
from(xxx)
...
...
.setHeader("innerCodeList",simple("${body.OriginCodeList}"))
.to("mybatis:selectByInnerCodeList?statementType=SelectList&inputHeader=innerCodeList")
MyBatisのマッパーXML失敗:
<select id="selectByInnerCodeList" resultMap="BaseResultMap" parameterType="java.util.List">
select
<include refid="Base_Column_List" />
from MF_FundManagerNew
WHERE Incumbent=1
<if test="innerCodeList!=null and innerCodeList.size()>0 ">
and InnerCode IN
<foreach collection="innerCodeList" item="innerCodeSingle" open="(" close=")" separator=",">
#{innerCodeSingle}
</foreach>
</if>
</select>
第二の例は、次の例外がスローされます。
Error querying database. Cause: org.apache.ibatis.binding.BindingException:
Parameter 'innerCodeList' not found. Available parameters are [collection, list]
Cause: org.apache.ibatis.binding.BindingException: Parameter 'innerCodeList' not found. Available parameters are [collection, list]
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) ~[mybatis-3.4.1.jar:3.4.1]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150) ~[mybatis-3.4.1.jar:3.4.1]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) ~[mybatis-3.4.1.jar:3.4.1]
at org.apache.camel.component.mybatis.MyBatisProducer.doSelectList(MyBatisProducer.java:117) ~[camel-mybatis-2.20.0.jar:2.20.0]
at org.apache.camel.component.mybatis.MyBatisProducer.process(MyBatisProducer.java:63) ~[camel-mybatis-2.20.0.jar:2.20.0]
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) ~[camel-core-2.20.0.jar:2.20.0]
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148) ~[camel-core-2.20.0.jar:2.20.0]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) [camel-core-2.20.0.jar:2.20.0]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) [camel-core-2.20.0.jar:2.20.0]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:138) [camel-core-2.20.0.jar:2.20.0]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:101) [camel-core-2.20.0.jar:2.20.0]
at org.apache.camel.processor.FilterProcessor.process(FilterProcessor.java:57) [camel-core-2.20.0.jar:2.20.0]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) [camel-core-2.20.0.jar:2.20.0]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) [camel-core-2.20.0.jar:2.20.0]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) [camel-core-2.20.0.jar:2.20.0]
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97) [camel-core-2.20.0.jar:2.20.0]
at org.apache.camel.component.mybatis.MyBatisConsumer.processBatch(MyBatisConsumer.java:130) [camel-mybatis-2.20.0.jar:2.20.0]
at org.apache.camel.component.mybatis.MyBatisConsumer.poll(MyBatisConsumer.java:100) [camel-mybatis-2.20.0.jar:2.20.0]
at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174) [camel-core-2.20.0.jar:2.20.0]
at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101) [camel-core-2.20.0.jar:2.20.0]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_144]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_144]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_144]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_144]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_144]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_144]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_144]
だろう。しかし、あなたが望むならマップに 'list'を置くことができます。マップキーは' innerCodeList'になり、MyBatisは 'innerCodeList'のキーに対して解決することができます – MohamedSanaulla
あなたの答えにおかげでたくさんありました。ここで質問をするのは初めてのことですが、英語では貧しいことを申し訳なく思っています。 –
あなたの言うとおりに動作します、ありがとうございました –