Skip to content

FINERACT-2530: Fix 500 error on GET /provisioningentries/{id} when no loan products exist#5880

Merged
adamsaghy merged 1 commit into
apache:developfrom
AshharAhmadKhan:FINERACT-2530-fix-provisioning-entry-500-no-loans
May 25, 2026
Merged

FINERACT-2530: Fix 500 error on GET /provisioningentries/{id} when no loan products exist#5880
adamsaghy merged 1 commit into
apache:developfrom
AshharAhmadKhan:FINERACT-2530-fix-provisioning-entry-500-no-loans

Conversation

@AshharAhmadKhan
Copy link
Copy Markdown
Contributor

Description

When a provisioning entry exists but no loans have been disbursed yet,
calling GET /provisioningentries/{id} returns HTTP 500. The root cause
is an INNER JOIN in PROVISIONING_ENTRY_SUM_RESERVED_SCHEMA — when
m_loanproduct_provisioning_entry has no rows for the given history ID,
the join returns zero rows and Spring's queryForObject() throws
EmptyResultDataAccessException.

Fix: change INNER JOIN to LEFT JOIN so the query always returns one row
(totalReserved = NULL when no loan products exist), mapping cleanly
without throwing.

Picks up the work from #5621.

@AshharAhmadKhan AshharAhmadKhan force-pushed the FINERACT-2530-fix-provisioning-entry-500-no-loans branch from 420fa8a to 10786ca Compare May 22, 2026 18:26
@AshharAhmadKhan
Copy link
Copy Markdown
Contributor Author

@adamsaghy please trigger checks when you get a chance

… loan products exist

Change INNER JOIN to LEFT JOIN in PROVISIONING_ENTRY_SUM_RESERVED_SCHEMA so
that provisioning entries with no associated loan product rows still return a
valid result instead of throwing EmptyResultDataAccessException.

Add FeignProvisioningEntryTest to verify the fix.

FINERACT-2530: Fix wrong feign method name in test

FINERACT-2530: Fix test - create provisioning criteria before entry
@AshharAhmadKhan AshharAhmadKhan force-pushed the FINERACT-2530-fix-provisioning-entry-500-no-loans branch from 10786ca to 508f545 Compare May 25, 2026 11:39
@AshharAhmadKhan
Copy link
Copy Markdown
Contributor Author

@adamsaghy fixed the integration test, the previous version was passing an empty loan products list which the server rejects with 400. now it creates a loan product but skips disbursement, so the join table stays empty and actually exercises the fix. could you approve the workflows when you get a chance? thanks!

Copy link
Copy Markdown
Contributor

@adamsaghy adamsaghy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@adamsaghy adamsaghy merged commit a59d6bd into apache:develop May 25, 2026
105 of 106 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants