martinweiler commented on code in PR #4273:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4273#discussion_r3204905667


##########
addons/common/jbpm-usertask-storage-jpa/src/main/java/org/jbpm/usertask/jpa/repository/UserTaskInstanceRepository.java:
##########
@@ -42,6 +48,56 @@ public List<UserTaskInstanceEntity> 
findByIdentity(IdentityProvider identityProv
         return query.getResultList();
     }
 
+    public List<UserTaskInstanceEntity> 
findByIdentityAndFilter(IdentityProvider identityProvider, UserTaskFilter 
filter) {
+        // Start with identity-based query
+        List<UserTaskInstanceEntity> identityFiltered = 
findByIdentity(identityProvider);
+
+        // If no filter, return identity-filtered results
+        if (filter == null) {
+            return identityFiltered;

Review Comment:
   Isn't this kind of inefficient to create this first query, and in case of 
further filters, execute another query to apply the additional filters? Could 
we do something like the following instead?
   ```
   if(filter == null) {
       return findByIdentity(identityProvider);
   }
   
   // ... create single query combining identity and filter predicates
   ```



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to