Skip to content

FINERACT-3078: Replace native SQL in retrieveCurrency with QueryDSL query - #6932

Open
ImalkaPerera wants to merge 1 commit into
apache:developfrom
ImalkaPerera:FINERACT-3078
Open

ImalkaPerera wants to merge 1 commit into
apache:developfrom
ImalkaPerera:FINERACT-3078

Conversation

@ImalkaPerera

@ImalkaPerera ImalkaPerera commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Description

JIRA: https://issues.apache.org/jira/browse/FINERACT-3078

Replaces the native SQL in CurrencyReadPlatformServiceImpl.retrieveCurrency(String) with a type-safe QueryDSL query. Behaviour is unchanged: same columns, same where code = ? and order by name, and an unknown code still throws EmptyResultDataAccessException.

Changes

  • CurrencyReadPlatformServiceImpl: retrieveCurrency now uses SQLQueryFactory with the generated QMCurrency type.
  • CurrencyDataProjection (new): MappingProjection that maps the selected columns to CurrencyData, following the pattern of FinancialActivityAccountProjection.
  • fineract-core/dependencies.gradle: fineract-core now depends on fineract-querydsl so the generated Q-types are available there.
  • OrganisationMonetaryConfiguration: passes SQLQueryFactory to the service constructor.

CurrencyRowMapper and JdbcTemplate stay in the class until FINERACT-3076 and FINERACT-3077 convert the two remaining queries (retrieveAllowedCurrencies, retrieveAllPlatformCurrencies).

Testing

  • New CurrencyReadPlatformServiceImplTest runs the query through a real SQLQueryFactory on a mocked JDBC connection (PostgreSQL and MySQL templates). It asserts the generated SQL, the bound parameter, the result mapping, nullable columns and the not-found exception.
  • The service was also run against PostgreSQL 18.3 and MariaDB 12.2 for all 164 seeded currencies plus an unknown code; results matched the previous SQL.
  • fineract-core tests pass (591), and fineract-provider compiles with the constructor change.

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Write the commit message as per our guidelines
  • Acknowledge that we will not review PRs that are not passing the build ("green") - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
  • Create/update unit or integration tests for verifying the changes made.
  • Follow our coding conventions.
  • Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
  • This PR must not be a "code dump". Large changes can be made in a branch, with assistance. Ask for help on the developer mailing list.
  • If merging this PR resolves a JIRA issue, I will mark that issue as resolved and set "Fix Version/s" appropriately.
  • I followed the AI Policy.

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.

1 participant