Joe Luo created CAMEL-6498:
------------------------------

             Summary: Improvement to allow passing in a parameter to a 
NamedQuery via Camel JPA
                 Key: CAMEL-6498
                 URL: https://issues.apache.org/jira/browse/CAMEL-6498
             Project: Camel
          Issue Type: Improvement
          Components: camel-jpa
    Affects Versions: 2.10.3
         Environment: Camel-JPA component deployed inside Karaf OSGi container
Java 1.6
            Reporter: Joe Luo


I have an Entity definition as below:

{code}
@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;
...
{code}
And my camel route camel-jpa uri looks like:
{code}
<to 
uri="jpa://com.mycompany.persistence.TimesheetEntity?consumeDelete=false&amp;consumer.namedQuery=getTimesheetById"/>
{code}

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.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to