AshharAhmadKhan opened a new pull request, #5739: URL: https://github.com/apache/fineract/pull/5739
Description JIRA: https://issues.apache.org/jira/browse/FINERACT-2579 The `generateLoanProvisioningEntry()` method in `ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl` was firing five individual repository queries per loop iteration — `LoanProduct`, `Office`, `ProvisioningCategory`, and both `GLAccount` entries — for every row returned by `retrieveLoanProductsProvisioningData()`, causing N×5 redundant DB round-trips on every provisioning entry creation or recreation request. Since all referenced IDs are known before the loop begins, this fix collects them upfront and replaces the individual lookups with four bulk `findAllById()` calls, reducing the total round-trips from N×5 to 4 regardless of entry count. In-memory map lookups replace the per-row DB calls inside the loop. This is the same class of redundancy fixed in FINERACT-2561 for `saveAllDebitOrCreditEntries()`, but more severe — five queries per iteration instead of one, on a batch job path that processes every active loan product across all offices. No logic change — all entity resolution still happens, and proper Fineract exceptions (`LoanProductNotFoundException`, `OfficeNotFoundException`, `GLAccountNotFoundException`) are thrown if any entity is missing. `OfficeRepositoryWrapper` is replaced with `OfficeRepository` directly to enable bulk fetching. -- 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]
