camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Update database using Java DSL JPA
Date Mon, 04 Mar 2013 15:44:37 GMT
On Mon, Mar 4, 2013 at 4:31 PM, golivamsi84 <> wrote:
> Hello,
> I am pretty new in using camel and we are just trying to incorporate it in
> our architecture, so everyone here is pretty new to Camel. So please forgive
> me if this so basic question.

Welcome to the community.

> Question:
> I am trying to access and update oracle database using JPA Hibernate. So I
> created my route for now which reads data from the database, I believe it
> just runs a select query and I can see the results.
> from("oracleJpa://")
>                 .to("stream:out");
> So can someone help me how I can update records in the database.Please
> explain me in detail if you can so that I can understand the flow. We are
> struggling on this one for a while now.

It depends what you want to update.

The JPA component in the <from> is designed to be a data transfer with
a table having the data.
So the idea is that Camel polls the table for new row(s). And after
they have been processed.
The row(s) can either be DELETED or UPDATED. And for updated you would
for example need
to set some column as a "flag" to indicate they have been processed.
So on the next poll these row(s)
is not picked up again.

There is a @Consumed  annotation you should add to a method on your
Entity bean. Then Camel calls that to update the entity. Then you can
use java code to set the "flag".

There is a little example from unti test here

> thanks
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
Red Hat, Inc.
FuseSource is now part of Red Hat
Twitter: davsclaus
Author of Camel in Action:

View raw message