Ashhar Ahmad Khan created FINERACT-2583:
-------------------------------------------

             Summary: Performance issue: per-iteration entity lookups inside 
loops in holiday office selection, provisioning criteria, and collateral 
assembly
                 Key: FINERACT-2583
                 URL: https://issues.apache.org/jira/browse/FINERACT-2583
             Project: Apache Fineract
          Issue Type: Bug
            Reporter: Ashhar Ahmad Khan


Three methods execute individual repository queries per loop iteration where 
all IDs are known before the loop begins, causing N redundant DB round-trips 
per invocation.

HolidayWritePlatformServiceJpaRepositoryImpl.getSelectedOffices() calls 
officeRepositoryWrapper.findOneWithNotFoundDetection(officeId) on every 
iteration.

ProvisioningCriteriaAssembler.parseLoanProducts() calls 
loanProductRepository.findById(productId) on every iteration.

CollateralAssembler.fromParsedJson() calls 
codeValueRepository.findOneWithNotFoundDetection(collateralTypeId) on every 
iteration.

Fix: collect all IDs upfront, bulk fetch via findAllById(), build an in-memory 
map, and replace per-row DB calls with map lookups inside the loop.

Same class of redundancy as FINERACT-2579.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to