adamsaghy commented on code in PR #6154:
URL: https://github.com/apache/fineract/pull/6154#discussion_r3622312077


##########
fineract-cob/src/main/java/org/apache/fineract/cob/domain/AbstractLockingService.java:
##########
@@ -64,17 +65,20 @@ public List<Long> findLockIdsByLoanIdIn(List<Long> loanIds) 
{
         if (loanIds.isEmpty()) {
             return Collections.emptyList();
         }
-        String sql = "SELECT loan_id FROM " + getTableName() + " WHERE loan_id 
IN (:ids)";
-        return namedParameterJdbcTemplate.queryForList(sql, Map.of("ids", 
loanIds), Long.class);
+        // Uses DatabaseSpecificSQLGenerator.in() to emit ANY(?) on PostgreSQL 
instead of IN($1,...$N),
+        // so all batch sizes share one query plan instead of one per distinct 
size.
+        final String sql = "SELECT loan_id FROM " + getTableName() + " WHERE " 
+ sqlGenerator.in("loan_id", loanIds);
+        return jdbcTemplate.queryForList(sql, Long.class, 
sqlGenerator.inParametersFor(loanIds));

Review Comment:
   We dont need the `namedParameterJdbcTemplate` anymore?



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