Hi all,
in Camel 2.13.2, I'm transferring data from one database to another like so:
.setBody(simple("SELECT fieldA, fieldB FROM table1 LIMIT 1"))
.to("jdbc:DataSourceService1")
.split(body())
.log("${body }) // This logs: {fieldA=100, fieldB=null}
.setBody(simple("INSERT INTO table2(fieldA, fieldB) VALUES (${body[fieldA]},
${body[fieldB]})"))
.to("jdbc:DataSourceService2")
In the INSERT statement, the null value of fieldB is converted to an empty
string,
resulting in something like: INSERT INTO table2(fieldA, fieldB) VALUES (100, )
Is it possible to avoid this conversion? I could use a custom Processor
or check the length of ${body[fieldB]} before using it,
but I would like to keep the route as simple as possible.
So is there any other way?
Best Regards,
--
Jan Schulze