You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/10/19 18:45:10 UTC

[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #1932: Increase test coverage for Spring dependent extensions

ppalaga commented on a change in pull request #1932:
URL: https://github.com/apache/camel-quarkus/pull/1932#discussion_r507983471



##########
File path: integration-tests/jpa/src/main/java/org/apache/camel/quarkus/component/jpa/it/JpaResource.java
##########
@@ -49,6 +56,51 @@
         return consumerTemplate.receiveBodyNoWait("jpa:" + Fruit.class.getName(), List.class);
     }
 
+    @Path("/get/{id}")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    public Fruit getFruit(@PathParam("id") int id) {
+        return producerTemplate.requestBody("jpa:" + Fruit.class.getName() + "?findEntity=true", id, Fruit.class);
+    }
+
+    @Path("/get/query/{id}")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    @SuppressWarnings("unchecked")
+    public List<Fruit> getFruitByQuery(@PathParam("id") int id) {
+        return producerTemplate.requestBody("jpa:" + Fruit.class.getName() + "?query="
+                + "select f from " + Fruit.class.getName() + " f where f.id = " + id,
+                null, List.class);
+    }
+
+    @Path("/get/query/named/{id}")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    @SuppressWarnings("unchecked")
+    public List<Fruit> getFruitByNamedQuery(@PathParam("id") int id) {
+        Map<String, Object> queryParams = new HashMap<>();
+        queryParams.put("fruitId", id);
+        context.getRegistry().bind("parameters", queryParams);

Review comment:
       Shouldn't we add a comment here that this is not a good pattern to copy in a real application?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org