You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Router <ro...@trash-mail.com> on 2014/11/05 08:51:22 UTC

POJO to DB

Hi,

I have got a POJO which contains values for two sequential SQL inserts. How
can I achieve this?

I tried something like this, but it fails due to the fact that named query
parameters (:#column) just work for HashMaps. I cannot find any
documentation how to proceed with my POJO. The conversion of my POJO to a
HashMap feels wrong..

		<route>
			<from uri="IncomingMessage:X:Y"/>
			<process ref="MyPOJOProcessor"/>
			<to uri="sql:{{sql.insertA}}"/>
			<to uri="sql:{{sql.insertB}}"/>
		</route>

Unfortunatelly, I need to keep my insert statements configurable via spring. 




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

Re: POJO to DB

Posted by Charlie Mordant <cm...@gmail.com>.
​​
Hi,

Either you have to use a message converter (transforming you pojo to a key
value hashmap): http://camel.apache.org/messaging-mapper.html
Or you can use camel-jpa if it's a jpa entity.

Regards,

2014-11-05 8:51 GMT+01:00 Router <ro...@trash-mail.com>:

> Hi,
>
> I have got a POJO which contains values for two sequential SQL inserts. How
> can I achieve this?
>
> I tried something like this, but it fails due to the fact that named query
> parameters (:#column) just work for HashMaps. I cannot find any
> documentation how to proceed with my POJO. The conversion of my POJO to a
> HashMap feels wrong..
>
>                 <route>
>                         <from uri="IncomingMessage:X:Y"/>
>                         <process ref="MyPOJOProcessor"/>
>                         <to uri="sql:{{sql.insertA}}"/>
>                         <to uri="sql:{{sql.insertB}}"/>
>                 </route>
>
> Unfortunatelly, I need to keep my insert statements configurable via
> spring.
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/POJO-to-DB-tp5758520.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Charlie Mordant

Full OSGI/EE stack made with Karaf:
https://github.com/OsgiliathEnterprise/net.osgiliath.parent