camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: spliting iBatis query result
Date Mon, 31 Dec 2007 15:59:22 GMT
On 27/12/2007, Roman Kalukiewicz <roman.kalukiewicz@gmail.com> wrote:
> 2007/12/26, thiamteck <thiamteck@gmail.com>:
> >
> > hi,
> >
> > I am experiment with Camel before use it in production. I start with iBatis
> > component. I try to query record from a table via iBatis and then route it
> > to another table via iBatis.
> >
> > from("ibatis://test.getMsg").to("ibatis://test.insertMsg");
> >
> > The problem i face is, "test.getMsg" return an ArrayList of the result
> > object, while "test.insertMsg" expecting a individual object instead of
> > ArrayList.
> >
> > Is there any way to split the ArrayList into multiple objects in the list so
> > that the insert statement can work?
>
> Maybe you should simply use splitter? As the message body is already
> an array it should be enough to do it this way:
>
> from("ibatis://test.getMsg").splitter(body()).to("ibatis://test.insertMsg");

Good idea!

I kinda figured that the iBatis should try to do the right thing by
default if it can. So I've applied a trivial patch to the iBatis
component (IBatisProducer to be precise) to automatically deal with
Collections or arrays of objects when evaluating insert/update
operations so that it does the right thing by default. Here's the
JIRA...
https://issues.apache.org/activemq/browse/CAMEL-282

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Mime
View raw message