Take a look at JPA, then you can insert/update by just changing the details on the JPA entity class. http://camel.apache.org/jpa
On Tue, Nov 15, 2011 at 2:13 PM, focaldi <[email protected]> wrote: > it is ok but i dont like this solution :(. Beacuse I dont wan to use > JDBCTEMPLATE for update column. Please show me a way for proper solution. > > public class RouteDatabaseToJms extends RouteBuilder { > @Override > public void configure() throws Exception { > > DataSource ds = this.getContext().getRegistry().lookup("dataSource", > DataSource.class); > final JdbcTemplate jdbc = new JdbcTemplate(ds); > > > from("timer://foo?period=60000").setBody(constant("select * from > AIRPORT")).to("jdbc:dataSource"). > process(new Processor(){ > @Override > public void process(Exchange exchange) throws > Exception { > ArrayList<HashMap<String, Object>> data > = exchange.getIn().getBody(ArrayList.class); > for (HashMap<String, Object> item : data){ > > System.out.println("DATABASE:::item.IATA_CODE > :"+((String)item.get("IATA_CODE"))); > } > } > }).to("jms:queue:airport"); > > from("jms:queue:airport").process(new Processor(){ > > @Override > public void process(Exchange exchange) throws > Exception { > > ArrayList<HashMap<String, Object>> data = > exchange.getIn().getBody(ArrayList.class); > for (HashMap<String, Object> item : data){ > jdbc.execute("update airport set > description_tr='tamam' where id="+(BigDecimal)item.get("ID")); > > System.out.println("JMS:::item.IATA_CODE > :"+((String)item.get("IATA_CODE"))); > } > } > > }); > > } > > } > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/How-can-I-update-database-table-by-using-camel-routing-tp4994243p4994244.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- Claus Ibsen ----------------- FuseSource Email: [email protected] Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
