Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: documented the named query URI query option

...

In Camel 2.3 the JpaComponent will auto lookup the TransactionManager from the Registry which means you do not need to configure this on the JpaComponent as shown above. You only need to do so if there is ambiguity, in which case Camel will log a WARN.

Using a consumer with a named query

For consuming only selected entities, you can use the consumer.namedQuery URI query option. First, you have to define the named query in the JPA Entity class:

Code Block

@Entity
@NamedQuery(name = "step1", query = "select x from MultiSteps x where x.step = 1")
public class MultiSteps {
   ...
}

After that you can define a consumer uri like this one:

Code Block

from("jpa://org.apache.camel.examples.MultiSteps?consumer.namedQuery=step1")
.to("bean:myBusinessLogic");

Example

See Tracer Example for an example using JPA to store traced messages into a database.

...