@Test public void shouldReturnBatchOfParameterEntriesOfGivenSize() { database().withParameter("parameter").withParameterEntries("parameter", 100).build(); ParameterEntryDAO parameterEntryDAO = get(ParameterEntryDAO.class); QueryRunner runner = queryRunner(); List<ParameterEntry> entries = parameterEntryDAO.getParameterEntriesBatch(runner, "parameter", 0, 20); runner.close(); assertThat(entries).hasSize(20); }
public List<ParameterEntry> getParameterEntriesBatch(QueryRunner queryRunner, String parameterName, long lastEntryId, int batchSize) { SelectQuery query = createSelectQuery(parameterName); query.append(" and id > :lastId ").withArgument("lastId", lastEntryId).orderBy("id", Order.ASC).limit(batchSize); return queryRunner.queryList(query, new ParameterEntryMapper(configuration)); }
ParameterEntryDAO { public List<ParameterEntry> getParameterEntriesBatch(QueryRunner queryRunner, String parameterName, long lastEntryId, int batchSize) { SelectQuery query = createSelectQuery(parameterName); query.append(" and id > :lastId ").withArgument("lastId", lastEntryId).orderBy("id", Order.ASC).limit(batchSize); return queryRunner.queryList(query, new ParameterEntryMapper(configuration)); } }
ParameterEntryDAO { public List<ParameterEntry> getParameterEntriesBatch(QueryRunner queryRunner, String parameterName, long lastEntryId, int batchSize) { SelectQuery query = createSelectQuery(parameterName); query.append(" and id > :lastId ").withArgument("lastId", lastEntryId).orderBy("id", Order.ASC).limit(batchSize); return queryRunner.queryList(query, new ParameterEntryMapper(configuration)); } ParameterEntryDAO(DefaultJdbcConfig configuration); }
ParameterEntryDAO { public List<ParameterEntry> getParameterEntriesBatch(QueryRunner queryRunner, String parameterName, long lastEntryId, int batchSize) { SelectQuery query = createSelectQuery(parameterName); query.append(" and id > :lastId ").withArgument("lastId", lastEntryId).orderBy("id", Order.ASC).limit(batchSize); return queryRunner.queryList(query, new ParameterEntryMapper(configuration)); } ParameterEntryDAO(DefaultJdbcConfig configuration); long insert(QueryRunner queryRunner, ParameterEntry parameterEntry, long parameterId); List<Long> insert(QueryRunner queryRunner, Iterable<ParameterEntry> parameterEntries, long parameterId); Set<ParameterEntry> getParameterEntries(QueryRunner queryRunner, String parameterName); List<ParameterEntry> getParameterEntries(QueryRunner queryRunner, List<Long> ids); Set<JdbcParameterEntry> getJdbcParameterEntries(QueryRunner queryRunner, String parameterName); List<ParameterEntry> getParameterEntriesBatch(QueryRunner queryRunner, String parameterName, long lastEntryId, int batchSize); void deleteParameterEntries(QueryRunner queryRunner, String parameterName); void delete(QueryRunner queryRunner, long entryId); void delete(QueryRunner queryRunner, Iterable<Long> entriesIds); void update(QueryRunner queryRunner, long entryId, ParameterEntry entry); List<ParameterEntry> list(QueryRunner queryRunner, JdbcParameter parameter, ParameterEntriesFilter filters); }
ParameterEntryDAO { public List<ParameterEntry> getParameterEntriesBatch(QueryRunner queryRunner, String parameterName, long lastEntryId, int batchSize) { SelectQuery query = createSelectQuery(parameterName); query.append(" and id > :lastId ").withArgument("lastId", lastEntryId).orderBy("id", Order.ASC).limit(batchSize); return queryRunner.queryList(query, new ParameterEntryMapper(configuration)); } ParameterEntryDAO(DefaultJdbcConfig configuration); long insert(QueryRunner queryRunner, ParameterEntry parameterEntry, long parameterId); List<Long> insert(QueryRunner queryRunner, Iterable<ParameterEntry> parameterEntries, long parameterId); Set<ParameterEntry> getParameterEntries(QueryRunner queryRunner, String parameterName); List<ParameterEntry> getParameterEntries(QueryRunner queryRunner, List<Long> ids); Set<JdbcParameterEntry> getJdbcParameterEntries(QueryRunner queryRunner, String parameterName); List<ParameterEntry> getParameterEntriesBatch(QueryRunner queryRunner, String parameterName, long lastEntryId, int batchSize); void deleteParameterEntries(QueryRunner queryRunner, String parameterName); void delete(QueryRunner queryRunner, long entryId); void delete(QueryRunner queryRunner, Iterable<Long> entriesIds); void update(QueryRunner queryRunner, long entryId, ParameterEntry entry); List<ParameterEntry> list(QueryRunner queryRunner, JdbcParameter parameter, ParameterEntriesFilter filters);  }