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 Thu, 07 Mar 2013 15:03:35 GMT
On Tue, Mar 5, 2013 at 9:55 PM, Baalu <> wrote:
> I looked at your example and it used Camel 2.11, but we are using 2.10.3
> where we dont have a hibernate component.
> We are using JPA component, is there any way we can use consumer.query or
> consumer.nativequery or a namedquery on it to update the database. What is
> the best way to update one column in a route something like this:

I think these are only in use if you use camel-jpa in the from in a route, eg

> from(direct:input)
> .to(create an update query)
> .to(jpa:entity)
> Can we use a parametrized UPDATE query somehow to specify the columns and
> values to update?

You can use the JPA API to do that. The idea with JPA is to abstract
the database layer and work with the objects.
So you fetch the entity using the JPA API. And then change the object
(entity) and then use the JPA API to merge / flush the changes.

Though for the latter, you can also use the Camel JPA producer, eg to in a route

PS: Sometimes working with SQL is easier.

> --
> 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