@CronTarget(jobName = JobName.POST_INTEREST_FOR_SAVINGS) @Override public void postInterestForAccounts() throws JobExecutionException { final List<SavingsAccount> savingsAccounts = this.savingAccountRepository.findSavingAccountByStatus( SavingsAccountStatusType.ACTIVE.getValue()); StringBuffer sb = new StringBuffer(); for (final SavingsAccount savingsAccount : savingsAccounts) { try { this.savingAccountAssembler.assignSavingAccountHelpers(savingsAccount); this.savingsAccountWritePlatformService.postInterest(savingsAccount); } catch (Exception e) { Throwable realCause = e; if (e.getCause() != null) { realCause = e.getCause(); } sb.append( "failed to post interest for Savings with id " + savingsAccount.getId() + " with message " + realCause.getMessage()); } } if (sb.length() > 0) { throw new JobExecutionException(sb.toString()); } }