[FINERACT-1678] Exception fix if every loan fail during COB

This commit is contained in:
taskain7
2023-03-02 15:44:23 +01:00
committed by Adam Saghy
parent 3853111628
commit 29dd1e730c
3 changed files with 9 additions and 13 deletions
@@ -36,9 +36,11 @@ public abstract class AbstractLoanItemWriter extends RepositoryItemWriter<Loan>
@Override
public void write(@NotNull List<? extends Loan> items) throws Exception {
super.write(items);
List<Long> loanIds = items.stream().map(AbstractPersistableCustom::getId).toList();
accountLockRepository.deleteByLoanIdInAndLockOwner(loanIds, getLockOwner());
if (!items.isEmpty()) {
super.write(items);
List<Long> loanIds = items.stream().map(AbstractPersistableCustom::getId).toList();
accountLockRepository.deleteByLoanIdInAndLockOwner(loanIds, getLockOwner());
}
}
protected abstract LockOwner getLockOwner();