galovics commented on a change in pull request #2025:
URL: https://github.com/apache/fineract/pull/2025#discussion_r801555887
##########
File path:
fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountReadPlatformServiceImpl.java
##########
@@ -230,6 +246,495 @@ public SavingsAccountData retrieveOne(final Long
accountId) {
}
}
+ @Override
+ public List<SavingsAccountTransactionData>
retrieveAllTransactionData(final List<String> refNo) throws DataAccessException
{
+ String inSql = String.join(",", Collections.nCopies(refNo.size(),
"?"));
+ String sql = "select " +
this.savingsAccountTransactionsForBatchMapper.schema() + " where tr.ref_no in
(%s)";
+ Object[] params = new Object[refNo.size()];
+ int i = 0;
+ for (String element : refNo) {
+ params[i] = element;
+ i++;
+ }
+ return this.jdbcTemplate.query(String.format(sql, inSql),
this.savingsAccountTransactionsForBatchMapper, params);
+ }
+
+ @Override
+ public List<SavingsAccountData>
retrieveAllSavingsDataForInterestPosting(final boolean
backdatedTxnsAllowedTill, final int pageSize,
+ final Integer status, final Long maxSavingsId) {
+ LocalDate currentDate = DateUtils.getLocalDateOfTenant().minusDays(1);
+
+ String sql = "select " +
this.savingAccountMapperForInterestPosting.schema()
+ + "join (select a.id from m_savings_account a where a.id > ?
and a.status_enum = ? limit ?) b on b.id = sa.id ";
+ if (backdatedTxnsAllowedTill) {
+ sql = sql
+ + "where if (sa.interest_posted_till_date is not null,
tr.transaction_date >= sa.interest_posted_till_date, tr.transaction_date >=
sa.activatedon_date) ";
+ }
+
+ sql = sql + "and apm.product_type=2 and sa.interest_posted_till_date<"
+ java.sql.Date.valueOf(currentDate);
+ sql = sql + " order by sa.id, tr.transaction_date, tr.created_date,
tr.id";
Review comment:
@fynmanoj not trying to block this at all. Just a few more questions.
Any chance you have a comparison between a functionally equivalent JPQL query
and the native query? I'd be really curious how much performance overhead you
experienced here.
Also, do you have the code for the JPQL version?
--
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]