[ 
https://issues.apache.org/jira/browse/CAMEL-12878?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16649796#comment-16649796
 ] 

ASF GitHub Bot commented on CAMEL-12878:
----------------------------------------

dmvolod commented on a change in pull request #2564: CAMEL-12878: camel-jpa: 
Allow for passing named-query parameters via message header
URL: https://github.com/apache/camel/pull/2564#discussion_r225052643
 
 

 ##########
 File path: 
components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaProducerWithQueryParametersHeaderTest.java
 ##########
 @@ -0,0 +1,93 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor.jpa;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jpa.JpaConstants;
+import org.apache.camel.examples.Customer;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.util.ServiceHelper;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class JpaProducerWithQueryParametersHeaderTest extends Assert {
+    
+    protected static final Logger LOG = 
LoggerFactory.getLogger(JpaProducerWithQueryParametersHeaderTest.class);
+    
+    protected DefaultCamelContext camelContext;
+    protected ProducerTemplate template;
+
+    @Test
+    @SuppressWarnings("rawtypes")
+    public void testProducerWithNamedQuery() throws Exception {
+        template.sendBody("direct:deleteCustomers", "");
+        Customer c1 = new Customer();
+        c1.setName("Willem");
+        template.sendBody("direct:addCustomer", c1);
+        Customer c2 = new Customer();
+        c2.setName("Dummy");
+        template.sendBody("direct:addCustomer", c2);
+        
+        Map<String, Object> params = new HashMap<>();
+        params.put("custName", "${body}");
+
+        //Object answer = template.requestBodyAndHeader("direct:namedQuery", 
"Willem", JpaConstants.JPA_PARAMETERS_HEADER, params);
 
 Review comment:
   Thanks, @aldettinger , missed it.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> camel-jpa: Allow for passing named-query parameters via message header and/or 
> body
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-12878
>                 URL: https://issues.apache.org/jira/browse/CAMEL-12878
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jpa
>    Affects Versions: 2.22.1
>            Reporter: Jochen Cordes
>            Assignee: Dmitry Volodin
>            Priority: Major
>
> Right now camel-jpa allows for passing parameters to named-queries via a bean 
> in the registry. For ease of use it should also be possible to pass 
> parameters via message header and/or body (i.e. using a HashMap and 
> key/values for parameter-name and parameter-value).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to