adamsaghy commented on code in PR #3132:
URL: https://github.com/apache/fineract/pull/3132#discussion_r1170988256


##########
fineract-provider/src/main/java/org/apache/fineract/cob/domain/LoanAccountLockRepository.java:
##########
@@ -32,4 +35,26 @@ public interface LoanAccountLockRepository extends 
JpaRepository<LoanAccountLock
     List<LoanAccountLock> findAllByLoanIdIn(List<Long> loanIds);
 
     boolean existsByLoanIdAndLockOwner(Long loanId, LockOwner lockOwner);
+
+    @Query(value = """
+                                                 update m_loan as loan set 
loan.last_closed_business_date = (select lck.lock_placed_on_cob_business_date - 
1
+                                                 from m_loan_account_locks lck
+                                                 where lck.loan_id = loan.id
+                                                   and 
lck.lock_placed_on_cob_business_date is not null
+                                                   and lck.error is not null
+                                                   and lck.lock_owner in 
(:lockOwners))
+            where loan.last_closed_business_date is null and exists  (select 
lck.loan_id
+                          from m_loan_account_locks lck  where lck.loan_id = 
loan.id
+                            and lck.lock_placed_on_cob_business_date is not 
null and lck.error is not null
+                            and lck.lock_owner in (:lockOwners))""", 
nativeQuery = true)
+    @Modifying(flushAutomatically = true)
+    void updateLoanFromAccountLocks(@Param("lockOwners") List<String> 
lockOwners);
+
+    @Query("""
+            update LoanAccountLock lck set

Review Comment:
   I reckon this should work for inline cob hard lock as well 
(LOAN_INLINE_COB_PROCESSING)



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