Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

FINERACT-3267: Use QueryDSL to get account number format - #7194

Open
PCTEJA wants to merge 2 commits into
apache:developfrom
PCTEJA:FINERACT-3267-account-number-format-querydsl
Open

PCTEJA wants to merge 2 commits into
apache:developfrom
PCTEJA:FINERACT-3267-account-number-format-querydsl

Conversation

@PCTEJA

@PCTEJA PCTEJA commented Dec 5, 2026

Copy link
Copy Markdown

Description

FINERACT-3267: native SQL inventory entry 075.

AccountNumberFormatReadPlatformServiceImpl#getAccountNumberFormat now uses a type safe QueryDSL query on the generated QCAccountNumberFormat instead of the native SQL string.

  • The proposed translation on the ticket imports the Q-type from org.apache.fineract.querydsl and aliases the selected columns. Neither is needed: the generated Q-type lives in org.apache.fineract.query and rows are read by path, as in the other converted read services.
  • The row to AccountNumberFormatData mapping moved into a shared toData(...) method. The JDBC RowMapper still used by getAllAccountNumberFormats (a separate inventory entry) calls it too, so both paths map rows the same way.
  • A missing row still raises AccountNumberFormatNotFoundException, now thrown directly on a null fetchOne() result (and up front for a null id) instead of via the caught EmptyResultDataAccessException.
  • The service is now @Transactional(readOnly = true) (Spring's). The SQLQueryFactory bean uses a SpringConnectionProvider, which refuses connections outside a transaction, so without it the lookup would fail.
  • No new unit test: the existing AccountNumberPreferencesTest integration test covers the endpoint on all 3 databases.

Checklist

  • 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. (No new test: the existing AccountNumberPreferencesTest covers this endpoint.)
  • 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 (no API change)
  • 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.

Replace the native SQL of AccountNumberFormatReadPlatformServiceImpl
#getAccountNumberFormat (native SQL inventory entry 075) with a
type safe QueryDSL query on the generated QCAccountNumberFormat.

The proposed translation on the ticket imports the Q-type from
org.apache.fineract.querydsl and aliases the selected columns;
neither is needed: the generated Q-type lives in
org.apache.fineract.query and rows are read by path, as in the
other converted read services.

The row to AccountNumberFormatData mapping is shared with the JDBC
RowMapper still used by getAllAccountNumberFormats (a separate
inventory entry), so both paths map rows the same way. A missing
row still raises AccountNumberFormatNotFoundException, now thrown
directly on a null fetchOne() result instead of via the caught
EmptyResultDataAccessException.

The service is now @transactional(readOnly = true): the
SQLQueryFactory bean uses a SpringConnectionProvider, which
refuses connections outside a transaction.
QueryDSL rejects eq(null) with IllegalArgumentException before the
query runs, while the previous JdbcTemplate lookup bound SQL NULL,
matched no rows and raised AccountNumberFormatNotFoundException.
Throw AccountNumberFormatNotFoundException up front for a null id
so the service contract is unchanged.
@PCTEJA
PCTEJA force-pushed the FINERACT-3267-account-number-format-querydsl branch from 7bd5776 to 53ae60c Compare December 5, 2026 21:12
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