Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-6498

Improvement to allow passing in a parameter to a NamedQuery via Camel JPA

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.10.3
    • 2.12.0
    • camel-jpa
    • None
    • Camel-JPA component deployed inside Karaf OSGi container
      Java 1.6

    • Unknown

    Description

      I have an Entity definition as below:

      @Entity
      @Table(name="TIMESHEET")
      @NamedQuery(name = "getTimesheetById", query = "select t from TimesheetEntity t where t.id = :timesheetId ")
      
      public class TimesheetEntity extends BaseObject {
      
      @Id
      @GeneratedValue(strategy= GenerationType.AUTO)
      private Long id;
      Long userId;
      ...
      

      And my camel route camel-jpa uri looks like:

      <to uri="jpa://com.mycompany.persistence.TimesheetEntity?consumeDelete=false&amp;consumer.namedQuery=getTimesheetById"/>
      

      Now, I would like to pass in the ":timesheetId" parameter to the NamedQuery, for instance "timesheetId=12345". Unfortunately, it is not possible to dynamically pass the parameter to the NamedQuery in a camel route at the moment.

      It does look like that there were some other users tried to find a solution to the same problem so at least it is a common use case.

      We should allow passing in a parameter to a NamedQuery via Camel JPA.

      Attachments

        Activity

          People

            njiang Willem Jiang
            joeluo Joe Luo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: