galovics commented on code in PR #3080:
URL: https://github.com/apache/fineract/pull/3080#discussion_r1150550940
##########
fineract-provider/src/main/java/org/apache/fineract/cob/loan/FetchAndLockLoanTasklet.java:
##########
@@ -87,10 +92,21 @@ public RepeatStatus execute(@NotNull StepContribution
contribution, @NotNull Chu
return RepeatStatus.FINISHED;
}
- private void applySoftLock(List<Long> alreadySoftLockedAccounts) {
- for (Long loanId : alreadySoftLockedAccounts) {
- LoanAccountLock loanAccountLock = new LoanAccountLock(loanId,
LockOwner.LOAN_COB_PARTITIONING);
- loanAccountLockRepository.save(loanAccountLock);
- }
+ private void applySoftLock(List<Long> accountsToLock) {
+ LocalDate cobBusinessDate =
ThreadLocalContextUtil.getBusinessDateByType(BusinessDateType.COB_DATE);
+ jdbcTemplate.batchUpdate("""
+ INSERT INTO m_loan_account_locks (loan_id, version,
lock_owner, lock_placed_on, lock_placed_on_cob_business_date)
+ VALUES (?, ?, ?, ?, ?)
+ """, accountsToLock, getInClauseParameterSizeLimit(), (ps, id)
-> {
Review Comment:
With that approach, you can't do JDBC level batching. This is the only way
to do so.
--
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]