davsclaus commented on code in PR #9970:
URL: https://github.com/apache/camel/pull/9970#discussion_r1181382505


##########
components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java:
##########
@@ -202,10 +203,18 @@ protected void processQuery(Exchange exchange, 
EntityManager entityManager) {
 
     @SuppressWarnings("unchecked")
     private void configureParameters(Query query, Exchange exchange) {
-        int maxResults = getEndpoint().getMaximumResults();
+        final int maxResults = Objects.requireNonNullElse(
+                exchange.getIn().getHeader(JpaConstants.JPA_MAXIMUM_RESULTS, 
Integer.class),

Review Comment:
   You can use the getHeader that takes a default value to void the Objects 
method. This is the standard we use in Camel.



##########
components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaProducer.java:
##########
@@ -202,10 +203,18 @@ protected void processQuery(Exchange exchange, 
EntityManager entityManager) {
 
     @SuppressWarnings("unchecked")
     private void configureParameters(Query query, Exchange exchange) {
-        int maxResults = getEndpoint().getMaximumResults();
+        final int maxResults = Objects.requireNonNullElse(
+                exchange.getIn().getHeader(JpaConstants.JPA_MAXIMUM_RESULTS, 
Integer.class),
+                getEndpoint().getMaximumResults());
         if (maxResults > 0) {
             query.setMaxResults(maxResults);
         }
+        final int firstResult = Objects.requireNonNullElse(
+                exchange.getIn().getHeader(JpaConstants.JPA_FIRST_RESULT, 
Integer.class),

Review Comment:
   Same as before



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to