Repository navigation
FINERACT-3259: Migrate loan COB partition query to QueryDSL (SQL 067) - #7197
Open
SamarthPD-21 wants to merge 1 commit into
Open
SamarthPD-21 wants to merge 1 commit into
SamarthPD-21 wants to merge 1 commit into
Conversation
Signed-off-by: SamarthPD-21 <samarthpd21@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
FINERACT-3259: replaces the native SQL in
RetrieveAllNonClosedIdServiceImpl#retrieveLoanCOBPartitionswith QueryDSL (SQL 067 of FINERACT-2022).row_number() over (order by id)in a derived table,floor((n - 1) / pageSize)as the page, thenmin/max/countgrouped and ordered by page. The catch-up flag still only changes thelast_closed_business_datefilter.NON_CLOSED_LOAN_STATUSESlist rather than a hard-coded100, 200, 300, 303, 304. The values are the same.SQLQueryFactoryinstead ofNamedParameterJdbcTemplate, which only this query used.RetrieveLoanIdConfigurationis updated to match.LoanCOBPartitionerdoesn't open one, but the class is already@Transactional(readOnly = true)and is created through an@Bean, so the call runs in a read-only transaction.Testing
RetrieveAllNonClosedLoanIdServiceImplTestnow runs the query through a realSQLQueryFactoryon a mocked connection. It checks the generated SQL for PostgreSQL and MySQL, the bound parameters, the catch-up variant and the row mapping.RetrieveLoanCOBPartitionsDatabaseTest(Testcontainers,QuerydslDatabaseTest) inserts 15 loans across included and excluded statuses, the COB date, other dates and null dates. It runs the old native SQL and the new query against them for partition sizes 1, 2, 3, 4 and 100, with and without catch-up, and checks that the results are equal. It passed on PostgreSQL and on MySQL 8 (-PtestDatabaseEngine=mysql). I didn't run it on MariaDB.fineract-loangetstestFixtures(project(':fineract-qeract-cobalready has.org.apache.fineract.cob.loantests pass locally (62), and the Error Prone compile is clean.Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
guidelines
your responsibility to get a propo primarily the project'smaintainers.
Your assigned reviewer(s) will follow our guidelines for code reviews.