You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Ankur <an...@accenture.com> on 2013/09/30 13:58:41 UTC

Camel + Ibatis

Hi All,

I want to get whole data from one datasource which I want to insert into
another table at the same time to another datasource
For this i have created two datasource, two session factory and two ibatis
instances.

my route looks like this 
<route id="processSelect">
<from uri="timer:foo?period=20s" />
<transacted ref="PROPAGATION_REQUIRED" />
<to uri="mybatisSource:batchSelectProcess?statementType=SelectList" />
<to uri="mybatisTarget:batchInsertApprovals?statementType=InsertList" />
</route> 


I'm confused how to write insert statement for the same. As this source will
return List to me but how to refer that list while inserting 

Thanks for your help 



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Ibatis-tp5740547.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel + Ibatis

Posted by Ankur <an...@accenture.com>.
I have written my my insert statement like this 

<insert id="batchInsertApprovals" parameterType="java.util.List" >
insert into approvals (APPROVALID, SOURCESYSTEM, APPROVALTYPE, APPROVAL,
SOURCESYSTEMID,
APPROVALDESC, DELEGATEDBY, STATUS, ASSIGNEDDATE, DUEDATE, UPDATEDBY,
UPDATEDON)
values
<foreach item="item" collection="list" open ="(" separator="," close=")">
(
#{item.projectDetails.approvalId},#{item.projectDetails.approvalSystem},#{item.projectDetails.approvalType},#{item.projectDetails.approvalName},
#{item.projectDetails.prismId},
#{item.projectDetails.description},#{item.projectDetails.delegateBy},#{item.projectDetails.status},#{item.projectDetails.createdOn},#{item.projectDetails.dueDate},#{item.projectDetails.assignedApprovercuid},#{item.projectDetails.createdOn})
</foreach>
</insert> 


Using this i'm getting this error
"org.apache.ibatis.binding.BindingException: Parameter '__frch_item_0' not
found. Available parameters are [list] "

I had also tried removing projectDetails from values 

Could you please help me in writing ibatis insert query 

Thanks



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Ibatis-tp5740547p5740562.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel + Ibatis

Posted by Larry Meadors <la...@gmail.com>.
Mybatis won't insert a list - you need to make that work yourself.

It might be possible to do a for-each in your mapped statement to
create multiple inserts there, or if you're using mysql, use the
"insert ... values () () ... ()" syntax.

Larry