@Test public void given4EmployeesOneWithTax_whenGetUnprocessedEmployeeIds_thenReturnCorrectList() { Employee employee1 = anEmployee(); Employee employee2 = anEmployee(); Employee employee3 = anEmployee(); Employee employee4 = anEmployee(); asList(employee1, employee2, employee3, employee4).forEach(employeeRepository::save); TaxCalculation tax = new TaxCalculationTestBuilder() .withEmployee(employee2) .withYear(2014) .withMonth(5) .build(); taxCalculationRepository.save(tax); assertThat(taxCalculationRepository.getUnprocessedEmployeeIds(2014L, 5L, 0L)).containsOnly( employee1.getId(), employee3.getId(), employee4.getId() ); }
public List<Long> getUnprocessedEmployeeIds(long year, long month, long jobExecutionId) { TypedQuery<Long> namedQuery = entityManager .createNamedQuery(TaxCalculation.GET_UNPROCESSED_EMPLOYEES_IDS_BY_YEAR_AND_MONTH, Long.class); namedQuery.setParameter("year", (int) year); namedQuery.setParameter("month", (int) month); namedQuery.setParameter("jobExecutionId", jobExecutionId); return namedQuery.getResultList(); }
TaxCalculationRepository extends AbstractRepository<TaxCalculation> { public List<Long> getUnprocessedEmployeeIds(long year, long month, long jobExecutionId) { TypedQuery<Long> namedQuery = entityManager .createNamedQuery(TaxCalculation.GET_UNPROCESSED_EMPLOYEES_IDS_BY_YEAR_AND_MONTH, Long.class); namedQuery.setParameter("year", (int) year); namedQuery.setParameter("month", (int) month); namedQuery.setParameter("jobExecutionId", jobExecutionId); return namedQuery.getResultList(); } }
TaxCalculationRepository extends AbstractRepository<TaxCalculation> { public List<Long> getUnprocessedEmployeeIds(long year, long month, long jobExecutionId) { TypedQuery<Long> namedQuery = entityManager .createNamedQuery(TaxCalculation.GET_UNPROCESSED_EMPLOYEES_IDS_BY_YEAR_AND_MONTH, Long.class); namedQuery.setParameter("year", (int) year); namedQuery.setParameter("month", (int) month); namedQuery.setParameter("jobExecutionId", jobExecutionId); return namedQuery.getResultList(); }  }
TaxCalculationRepository extends AbstractRepository<TaxCalculation> { public List<Long> getUnprocessedEmployeeIds(long year, long month, long jobExecutionId) { TypedQuery<Long> namedQuery = entityManager .createNamedQuery(TaxCalculation.GET_UNPROCESSED_EMPLOYEES_IDS_BY_YEAR_AND_MONTH, Long.class); namedQuery.setParameter("year", (int) year); namedQuery.setParameter("month", (int) month); namedQuery.setParameter("jobExecutionId", jobExecutionId); return namedQuery.getResultList(); }  List<Long> getUnprocessedEmployeeIds(long year, long month, long jobExecutionId); List<TaxCalculation> find(int year, int month, long jobExecutionId); List<TaxCalculation> findByEmployee(Employee employee); Money getSuccessSum(int year, int month); Money getFailedSum(int year, int month); }
TaxCalculationRepository extends AbstractRepository<TaxCalculation> { public List<Long> getUnprocessedEmployeeIds(long year, long month, long jobExecutionId) { TypedQuery<Long> namedQuery = entityManager .createNamedQuery(TaxCalculation.GET_UNPROCESSED_EMPLOYEES_IDS_BY_YEAR_AND_MONTH, Long.class); namedQuery.setParameter("year", (int) year); namedQuery.setParameter("month", (int) month); namedQuery.setParameter("jobExecutionId", jobExecutionId); return namedQuery.getResultList(); }  List<Long> getUnprocessedEmployeeIds(long year, long month, long jobExecutionId); List<TaxCalculation> find(int year, int month, long jobExecutionId); List<TaxCalculation> findByEmployee(Employee employee); Money getSuccessSum(int year, int month); Money getFailedSum(int year, int month);  }