ruchiD commented on code in PR #3080:
URL: https://github.com/apache/fineract/pull/3080#discussion_r1150462174


##########
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:
   Hi Arnold, Did we compared execution time with @Modifying + @Query on 
repository method also for this optimization.



-- 
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]

Reply via email to