diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTest.java index d560784ca62..1a374c8ce31 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTest.java @@ -108,7 +108,7 @@ public void testSchedulerJobs() throws InterruptedException { Thread.sleep(15000); schedulerJob = this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, this.responseSpec, jobId.toString()); Assert.assertNotNull(schedulerJob); - System.out.println("Job is Still Running"); + System.out.println("Job " +jobId.toString() +" is Still Running"); } ArrayList jobHistoryData = this.schedulerJobHelper.getSchedulerJobHistory(this.requestSpec, this.responseSpec, jobId.toString()); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountRepositoryWrapper.java index 97427593b74..fc0afcf5077 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountRepositoryWrapper.java @@ -23,6 +23,8 @@ import org.apache.fineract.portfolio.savings.DepositAccountType; import org.apache.fineract.portfolio.savings.exception.SavingsAccountNotFoundException; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -79,8 +81,15 @@ public List findSavingAccountByStatus(@Param("status") Integer s loadLazyCollections(accounts); return accounts ; } + + @Transactional(readOnly=true) + public Page findByStatus(Integer status, Pageable pageable) { + Page accounts = this.repository.findByStatus(status, pageable); + loadLazyCollections(accounts); + return accounts; + } - //Root Entities are enough + //Root Entities are enough public List findByClientIdAndGroupId(@Param("clientId") Long clientId, @Param("groupId") Long groupId) { return this.repository.findByClientIdAndGroupId(clientId, groupId) ; } @@ -118,4 +127,10 @@ private void loadLazyCollections(final List accounts) { } } } + + private void loadLazyCollections(Page accounts) { + for (SavingsAccount account : accounts) { + account.loadLazyCollections(); + } + } } \ No newline at end of file diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsSchedularServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsSchedularServiceImpl.java index 16c4266603e..bd41c22b71c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsSchedularServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsSchedularServiceImpl.java @@ -27,6 +27,7 @@ import org.apache.fineract.portfolio.savings.domain.SavingsAccount; import org.apache.fineract.portfolio.savings.domain.SavingsAccountAssembler; import org.apache.fineract.portfolio.savings.domain.SavingsAccountRepository; +import org.apache.fineract.portfolio.savings.domain.SavingsAccountRepositoryWrapper; import org.apache.fineract.portfolio.savings.domain.SavingsAccountStatusType; import org.joda.time.LocalDate; import org.springframework.beans.factory.annotation.Autowired; @@ -40,12 +41,12 @@ public class SavingsSchedularServiceImpl implements SavingsSchedularService { private final SavingsAccountAssembler savingAccountAssembler; private final SavingsAccountWritePlatformService savingsAccountWritePlatformService; private final SavingsAccountReadPlatformService savingAccountReadPlatformService; - private final SavingsAccountRepository savingsAccountRepository; + private final SavingsAccountRepositoryWrapper savingsAccountRepository; @Autowired public SavingsSchedularServiceImpl(final SavingsAccountAssembler savingAccountAssembler, final SavingsAccountWritePlatformService savingsAccountWritePlatformService, - final SavingsAccountReadPlatformService savingAccountReadPlatformService, final SavingsAccountRepository savingsAccountRepository) { + final SavingsAccountReadPlatformService savingAccountReadPlatformService, final SavingsAccountRepositoryWrapper savingsAccountRepository) { this.savingAccountAssembler = savingAccountAssembler; this.savingsAccountWritePlatformService = savingsAccountWritePlatformService; this.savingAccountReadPlatformService = savingAccountReadPlatformService;