Polishing.

Use consistent method and argument names for newly introduced methods. Reorder and group template API methods to keep related methods together.

See: #1315
Original pull request: #1324.
This commit is contained in:
Mark Paluch
2022-10-05 14:41:03 +02:00
committed by Jens Schauder
parent aef1e34f5e
commit 26c5c5dd93
8 changed files with 234 additions and 232 deletions

View File

@@ -81,6 +81,130 @@ public interface JdbcAggregateOperations {
*/
<T> T update(T instance);
/**
* Counts the number of aggregates of a given type.
*
* @param domainType the type of the aggregates to be counted.
* @return the number of instances stored in the database. Guaranteed to be not {@code null}.
*/
long count(Class<?> domainType);
/**
* Counts the number of aggregates of a given type that match the given <code>query</code>.
*
* @param query must not be {@literal null}.
* @param domainType the entity type must not be {@literal null}.
* @return the number of instances stored in the database. Guaranteed to be not {@code null}.
* @since 3.0
*/
<T> long count(Query query, Class<T> domainType);
/**
* Determine whether there are aggregates that match the {@link Query}
*
* @param query must not be {@literal null}.
* @param domainType the entity type must not be {@literal null}.
* @return {@literal true} if the object exists.
* @since 3.0
*/
<T> boolean exists(Query query, Class<T> domainType);
/**
* Checks if an aggregate identified by type and id exists in the database.
*
* @param id the id of the aggregate root.
* @param domainType the type of the aggregate root.
* @param <T> the type of the aggregate root.
* @return whether the aggregate exists.
*/
<T> boolean existsById(Object id, Class<T> domainType);
/**
* Load an aggregate from the database.
*
* @param id the id of the aggregate to load. Must not be {@code null}.
* @param domainType the type of the aggregate root. Must not be {@code null}.
* @param <T> the type of the aggregate root.
* @return the loaded aggregate. Might return {@code null}.
*/
@Nullable
<T> T findById(Object id, Class<T> domainType);
/**
* Load all aggregates of a given type that are identified by the given ids.
*
* @param ids of the aggregate roots identifying the aggregates to load. Must not be {@code null}.
* @param domainType the type of the aggregate roots. Must not be {@code null}.
* @param <T> the type of the aggregate roots. Must not be {@code null}.
* @return Guaranteed to be not {@code null}.
*/
<T> Iterable<T> findAllById(Iterable<?> ids, Class<T> domainType);
/**
* Load all aggregates of a given type.
*
* @param domainType the type of the aggregate roots. Must not be {@code null}.
* @param <T> the type of the aggregate roots. Must not be {@code null}.
* @return Guaranteed to be not {@code null}.
*/
<T> Iterable<T> findAll(Class<T> domainType);
/**
* Load all aggregates of a given type, sorted.
*
* @param domainType the type of the aggregate roots. Must not be {@code null}.
* @param <T> the type of the aggregate roots. Must not be {@code null}.
* @param sort the sorting information. Must not be {@code null}.
* @return Guaranteed to be not {@code null}.
* @since 2.0
*/
<T> Iterable<T> findAll(Class<T> domainType, Sort sort);
/**
* Load a page of (potentially sorted) aggregates of a given type.
*
* @param domainType the type of the aggregate roots. Must not be {@code null}.
* @param <T> the type of the aggregate roots. Must not be {@code null}.
* @param pageable the pagination information. Must not be {@code null}.
* @return Guaranteed to be not {@code null}.
* @since 2.0
*/
<T> Page<T> findAll(Class<T> domainType, Pageable pageable);
/**
* Execute a {@code SELECT} query and convert the resulting item to an entity ensuring exactly one result.
*
* @param query must not be {@literal null}.
* @param domainType the entity type must not be {@literal null}.
* @return exactly one result or {@link Optional#empty()} if no match found.
* @throws org.springframework.dao.IncorrectResultSizeDataAccessException if more than one match found.
* @since 3.0
*/
<T> Optional<T> findOne(Query query, Class<T> domainType);
/**
* Execute a {@code SELECT} query and convert the resulting items to a {@link Iterable} that is sorted.
*
* @param query must not be {@literal null}.
* @param domainType the entity type must not be {@literal null}.
* @return a non-null sorted list with all the matching results.
* @throws org.springframework.dao.IncorrectResultSizeDataAccessException if more than one match found.
* @since 3.0
*/
<T> Iterable<T> findAll(Query query, Class<T> domainType);
/**
* Returns a {@link Page} of entities matching the given {@link Query}. In case no match could be found, an empty
* {@link Page} is returned.
*
* @param query must not be {@literal null}.
* @param domainType the entity type must not be {@literal null}.
* @param pageable can be null.
* @return a {@link Page} of entities matching the given {@link Example}.
* @since 3.0
*/
<T> Page<T> findAll(Query query, Class<T> domainType, Pageable pageable);
/**
* Deletes a single Aggregate including all entities contained in that aggregate.
* <p>
@@ -128,7 +252,7 @@ public interface JdbcAggregateOperations {
* there is no aggregate root with matching id. In other cases a NOOP delete is silently ignored.
* @deprecated since 3.0 use {@link #delete(Object)} instead
*/
@Deprecated
@Deprecated(since = "3.0")
default <T> void delete(T aggregateRoot, Class<T> domainType) {
delete(aggregateRoot);
}
@@ -154,137 +278,14 @@ public interface JdbcAggregateOperations {
* @param aggregateRoots to delete. Must not be {@code null}.
* @param domainType type of the aggregate roots to be deleted. Must not be {@code null}.
* @param <T> the type of the aggregate roots.
* @throws org.springframework.dao.OptimisticLockingFailureException when {@literal T} has a version attribute and for at least on entity the
* version attribute of the entity does not match the version attribute in the database, or when
* there is no aggregate root with matching id. In other cases a NOOP delete is silently ignored.
* @throws org.springframework.dao.OptimisticLockingFailureException when {@literal T} has a version attribute and for
* at least on entity the version attribute of the entity does not match the version attribute in the
* database, or when there is no aggregate root with matching id. In other cases a NOOP delete is silently
* ignored.
* @deprecated since 3.0 use {@link #deleteAll(Iterable)} instead.
*/
@Deprecated
@Deprecated(since = "3.0")
default <T> void deleteAll(Iterable<? extends T> aggregateRoots, Class<T> domainType) {
deleteAll(aggregateRoots);
}
/**
* Counts the number of aggregates of a given type.
*
* @param domainType the type of the aggregates to be counted.
* @return the number of instances stored in the database. Guaranteed to be not {@code null}.
*/
long count(Class<?> domainType);
/**
* Load an aggregate from the database.
*
* @param id the id of the aggregate to load. Must not be {@code null}.
* @param domainType the type of the aggregate root. Must not be {@code null}.
* @param <T> the type of the aggregate root.
* @return the loaded aggregate. Might return {@code null}.
*/
@Nullable
<T> T findById(Object id, Class<T> domainType);
/**
* Load all aggregates of a given type that are identified by the given ids.
*
* @param ids of the aggregate roots identifying the aggregates to load. Must not be {@code null}.
* @param domainType the type of the aggregate roots. Must not be {@code null}.
* @param <T> the type of the aggregate roots. Must not be {@code null}.
* @return Guaranteed to be not {@code null}.
*/
<T> Iterable<T> findAllById(Iterable<?> ids, Class<T> domainType);
/**
* Load all aggregates of a given type.
*
* @param domainType the type of the aggregate roots. Must not be {@code null}.
* @param <T> the type of the aggregate roots. Must not be {@code null}.
* @return Guaranteed to be not {@code null}.
*/
<T> Iterable<T> findAll(Class<T> domainType);
/**
* Checks if an aggregate identified by type and id exists in the database.
*
* @param id the id of the aggregate root.
* @param domainType the type of the aggregate root.
* @param <T> the type of the aggregate root.
* @return whether the aggregate exists.
*/
<T> boolean existsById(Object id, Class<T> domainType);
/**
* Load all aggregates of a given type, sorted.
*
* @param domainType the type of the aggregate roots. Must not be {@code null}.
* @param <T> the type of the aggregate roots. Must not be {@code null}.
* @param sort the sorting information. Must not be {@code null}.
* @return Guaranteed to be not {@code null}.
* @since 2.0
*/
<T> Iterable<T> findAll(Class<T> domainType, Sort sort);
/**
* Load a page of (potentially sorted) aggregates of a given type.
*
* @param domainType the type of the aggregate roots. Must not be {@code null}.
* @param <T> the type of the aggregate roots. Must not be {@code null}.
* @param pageable the pagination information. Must not be {@code null}.
* @return Guaranteed to be not {@code null}.
* @since 2.0
*/
<T> Page<T> findAll(Class<T> domainType, Pageable pageable);
/**
* Execute a {@code SELECT} query and convert the resulting item to an entity ensuring exactly one result.
*
* @param query must not be {@literal null}.
* @param entityClass the entity type must not be {@literal null}.
* @return exactly one result or {@link Optional#empty()} if no match found.
* @throws org.springframework.dao.IncorrectResultSizeDataAccessException if more than one match found.
* @since 3.0
*/
<T> Optional<T> selectOne(Query query, Class<T> entityClass);
/**
* Execute a {@code SELECT} query and convert the resulting items to a {@link Iterable} that is sorted.
*
* @param query must not be {@literal null}.
* @param entityClass the entity type must not be {@literal null}.
* @return a non-null sorted list with all the matching results.
* @throws org.springframework.dao.IncorrectResultSizeDataAccessException if more than one match found.
* @since 3.0
*/
<T> Iterable<T> select(Query query, Class<T> entityClass);
/**
* Determine whether there are aggregates that match the {@link Query}
*
* @param query must not be {@literal null}.
* @param entityClass the entity type must not be {@literal null}.
* @return {@literal true} if the object exists.
* @since 3.0
*/
<T> boolean exists(Query query, Class<T> entityClass);
/**
* Counts the number of aggregates of a given type that match the given <code>query</code>.
*
* @param query must not be {@literal null}.
* @param entityClass the entity type must not be {@literal null}.
* @return the number of instances stored in the database. Guaranteed to be not {@code null}.
* @since 3.0
*/
<T> long count(Query query, Class<T> entityClass);
/**
* Returns a {@link Page} of entities matching the given {@link Query}. In case no match could be found, an empty
* {@link Page} is returned.
*
* @param query must not be {@literal null}.
* @param entityClass the entity type must not be {@literal null}.
* @param pageable can be null.
* @return a {@link Page} of entities matching the given {@link Example}.
* @since 3.0
*/
<T> Page<T> select(Query query, Class<T> entityClass, Pageable pageable);
}

View File

@@ -213,6 +213,25 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
return accessStrategy.count(domainType);
}
@Override
public <T> long count(Query query, Class<T> domainType) {
return accessStrategy.count(query, domainType);
}
@Override
public <T> boolean exists(Query query, Class<T> domainType) {
return accessStrategy.exists(query, domainType);
}
@Override
public <T> boolean existsById(Object id, Class<T> domainType) {
Assert.notNull(id, "Id must not be null");
Assert.notNull(domainType, "Domain type must not be null");
return accessStrategy.existsById(id, domainType);
}
@Override
public <T> T findById(Object id, Class<T> domainType) {
@@ -226,15 +245,6 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
return triggerAfterConvert(entity);
}
@Override
public <T> boolean existsById(Object id, Class<T> domainType) {
Assert.notNull(id, "Id must not be null");
Assert.notNull(domainType, "Domain type must not be null");
return accessStrategy.existsById(id, domainType);
}
@Override
public <T> Iterable<T> findAll(Class<T> domainType, Sort sort) {
@@ -256,32 +266,22 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
}
@Override
public <T> Optional<T> selectOne(Query query, Class<T> entityClass) {
return accessStrategy.selectOne(query, entityClass);
public <T> Optional<T> findOne(Query query, Class<T> domainType) {
return accessStrategy.findOne(query, domainType);
}
@Override
public <T> Iterable<T> select(Query query, Class<T> entityClass) {
return accessStrategy.select(query, entityClass);
public <T> Iterable<T> findAll(Query query, Class<T> domainType) {
return accessStrategy.findAll(query, domainType);
}
@Override
public <T> boolean exists(Query query, Class<T> entityClass) {
return accessStrategy.exists(query, entityClass);
}
public <T> Page<T> findAll(Query query, Class<T> domainType, Pageable pageable) {
@Override
public <T> long count(Query query, Class<T> entityClass) {
return accessStrategy.count(query, entityClass);
}
@Override
public <T> Page<T> select(Query query, Class<T> entityClass, Pageable pageable) {
Iterable<T> items = triggerAfterConvert(accessStrategy.select(query, entityClass, pageable));
Iterable<T> items = triggerAfterConvert(accessStrategy.findAll(query, domainType, pageable));
List<T> content = StreamSupport.stream(items.spliterator(), false).collect(Collectors.toList());
return PageableExecutionUtils.getPage(content, pageable, () -> accessStrategy.count(query, entityClass));
return PageableExecutionUtils.getPage(content, pageable, () -> accessStrategy.count(query, domainType));
}
@Override
@@ -373,7 +373,6 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
private <T> void doDeleteAll(Iterable<? extends T> instances, Class<T> domainType) {
BatchingAggregateChange<T, DeleteAggregateChange<T>> batchingAggregateChange = BatchingAggregateChange
.forDelete(domainType);
Map<Object, T> instancesBeforeExecute = new LinkedHashMap<>();

View File

@@ -159,28 +159,28 @@ public class CascadingDataAccessStrategy implements DataAccessStrategy {
}
@Override
public <T> Optional<T> selectOne(Query query, Class<T> probeType) {
return collect(das -> das.selectOne(query, probeType));
public <T> Optional<T> findOne(Query query, Class<T> domainType) {
return collect(das -> das.findOne(query, domainType));
}
@Override
public <T> Iterable<T> select(Query query, Class<T> probeType) {
return collect(das -> das.select(query, probeType));
public <T> Iterable<T> findAll(Query query, Class<T> domainType) {
return collect(das -> das.findAll(query, domainType));
}
@Override
public <T> Iterable<T> select(Query query, Class<T> probeType, Pageable pageable) {
return collect(das -> das.select(query, probeType, pageable));
public <T> Iterable<T> findAll(Query query, Class<T> domainType, Pageable pageable) {
return collect(das -> das.findAll(query, domainType, pageable));
}
@Override
public <T> boolean exists(Query query, Class<T> probeType) {
return collect(das -> das.exists(query, probeType));
public <T> boolean exists(Query query, Class<T> domainType) {
return collect(das -> das.exists(query, domainType));
}
@Override
public <T> long count(Query query, Class<T> probeType) {
return collect(das -> das.count(query, probeType));
public <T> long count(Query query, Class<T> domainType) {
return collect(das -> das.count(query, domainType));
}
private <T> T collect(Function<DataAccessStrategy, T> function) {

View File

@@ -200,6 +200,36 @@ public interface DataAccessStrategy extends RelationResolver {
*/
long count(Class<?> domainType);
/**
* Counts the rows in the table representing the given probe type, that match the given <code>query</code>.
*
* @param domainType the probe type for which to count the elements. Must not be {@code null}.
* @param query the query which elements have to match.
* @return the count. Guaranteed to be not {@code null}.
* @since 3.0
*/
<T> long count(Query query, Class<T> domainType);
/**
* Determine whether there is an aggregate of type <code>domainType</code> that matches the provided {@link Query}.
*
* @param query must not be {@literal null}.
* @param domainType the type of entities. Must not be {@code null}.
* @return {@literal true} if the object exists.
* @since 3.0
*/
<T> boolean exists(Query query, Class<T> domainType);
/**
* returns if a row with the given id exists for the given type.
*
* @param id the id of the entity for which to check. Must not be {@code null}.
* @param domainType the type of the entity to check for. Must not be {@code null}.
* @param <T> the type of the entity.
* @return {@code true} if a matching row exists, otherwise {@code false}.
*/
<T> boolean existsById(Object id, Class<T> domainType);
/**
* Loads a single entity identified by type and id.
*
@@ -235,16 +265,6 @@ public interface DataAccessStrategy extends RelationResolver {
Iterable<Object> findAllByPath(Identifier identifier,
PersistentPropertyPath<? extends RelationalPersistentProperty> path);
/**
* returns if a row with the given id exists for the given type.
*
* @param id the id of the entity for which to check. Must not be {@code null}.
* @param domainType the type of the entity to check for. Must not be {@code null}.
* @param <T> the type of the entity.
* @return {@code true} if a matching row exists, otherwise {@code false}.
*/
<T> boolean existsById(Object id, Class<T> domainType);
/**
* Loads all entities of the given type, sorted.
*
@@ -271,54 +291,35 @@ public interface DataAccessStrategy extends RelationResolver {
* Execute a {@code SELECT} query and convert the resulting item to an entity ensuring exactly one result.
*
* @param query must not be {@literal null}.
* @param probeType the type of entities. Must not be {@code null}.
* @param domainType the type of entities. Must not be {@code null}.
* @return exactly one result or {@link Optional#empty()} if no match found.
* @throws org.springframework.dao.IncorrectResultSizeDataAccessException if more than one match found.
* @since 3.0
*/
<T> Optional<T> selectOne(Query query, Class<T> probeType);
<T> Optional<T> findOne(Query query, Class<T> domainType);
/**
* Execute a {@code SELECT} query and convert the resulting items to a {@link Iterable}.
*
* @param query must not be {@literal null}.
* @param probeType the type of entities. Must not be {@code null}.
* @param domainType the type of entities. Must not be {@code null}.
* @return a non-null list with all the matching results.
* @throws org.springframework.dao.IncorrectResultSizeDataAccessException if more than one match found.
* @since 3.0
*/
<T> Iterable<T> select(Query query, Class<T> probeType);
<T> Iterable<T> findAll(Query query, Class<T> domainType);
/**
* Execute a {@code SELECT} query and convert the resulting items to a {@link Iterable}. Applies the {@link Pageable}
* to the result.
*
* @param query must not be {@literal null}.
* @param probeType the type of entities. Must not be {@literal null}.
* @param domainType the type of entities. Must not be {@literal null}.
* @param pageable the pagination that should be applied. Must not be {@literal null}.
* @return a non-null list with all the matching results.
* @throws org.springframework.dao.IncorrectResultSizeDataAccessException if more than one match found.
* @since 3.0
*/
<T> Iterable<T> select(Query query, Class<T> probeType, Pageable pageable);
<T> Iterable<T> findAll(Query query, Class<T> domainType, Pageable pageable);
/**
* Determine whether there is an aggregate of type <code>probeType</code> that matches the provided {@link Query}.
*
* @param query must not be {@literal null}.
* @param probeType the type of entities. Must not be {@code null}.
* @return {@literal true} if the object exists.
* @since 3.0
*/
<T> boolean exists(Query query, Class<T> probeType);
/**
* Counts the rows in the table representing the given probe type, that match the given <code>query</code>.
*
* @param probeType the probe type for which to count the elements. Must not be {@code null}.
* @param query the query which elements have to match.
* @return the count. Guaranteed to be not {@code null}.
* @since 3.0
*/
<T> long count(Query query, Class<T> probeType);
}

View File

@@ -333,42 +333,42 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy {
}
@Override
public <T> Optional<T> selectOne(Query query, Class<T> probeType) {
public <T> Optional<T> findOne(Query query, Class<T> domainType) {
MapSqlParameterSource parameterSource = new MapSqlParameterSource();
String sqlQuery = sql(probeType).selectByQuery(query, parameterSource);
String sqlQuery = sql(domainType).selectByQuery(query, parameterSource);
try {
return Optional.ofNullable(
operations.queryForObject(sqlQuery, parameterSource, getEntityRowMapper(probeType)));
operations.queryForObject(sqlQuery, parameterSource, getEntityRowMapper(domainType)));
} catch (EmptyResultDataAccessException e) {
return Optional.empty();
}
}
@Override
public <T> Iterable<T> select(Query query, Class<T> probeType) {
public <T> Iterable<T> findAll(Query query, Class<T> domainType) {
MapSqlParameterSource parameterSource = new MapSqlParameterSource();
String sqlQuery = sql(probeType).selectByQuery(query, parameterSource);
String sqlQuery = sql(domainType).selectByQuery(query, parameterSource);
return operations.query(sqlQuery, parameterSource, getEntityRowMapper(probeType));
return operations.query(sqlQuery, parameterSource, getEntityRowMapper(domainType));
}
@Override
public <T> Iterable<T> select(Query query, Class<T> probeType, Pageable pageable) {
public <T> Iterable<T> findAll(Query query, Class<T> domainType, Pageable pageable) {
MapSqlParameterSource parameterSource = new MapSqlParameterSource();
String sqlQuery = sql(probeType).selectByQuery(query, parameterSource, pageable);
String sqlQuery = sql(domainType).selectByQuery(query, parameterSource, pageable);
return operations.query(sqlQuery, parameterSource, getEntityRowMapper(probeType));
return operations.query(sqlQuery, parameterSource, getEntityRowMapper(domainType));
}
@Override
public <T> boolean exists(Query query, Class<T> probeType) {
public <T> boolean exists(Query query, Class<T> domainType) {
MapSqlParameterSource parameterSource = new MapSqlParameterSource();
String sqlQuery = sql(probeType).existsByQuery(query, parameterSource);
String sqlQuery = sql(domainType).existsByQuery(query, parameterSource);
Boolean result = operations.queryForObject(sqlQuery, parameterSource, Boolean.class);
@@ -378,10 +378,10 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy {
}
@Override
public <T> long count(Query query, Class<T> probeType) {
public <T> long count(Query query, Class<T> domainType) {
MapSqlParameterSource parameterSource = new MapSqlParameterSource();
String sqlQuery = sql(probeType).countByQuery(query, parameterSource);
String sqlQuery = sql(domainType).countByQuery(query, parameterSource);
Long result = operations.queryForObject(sqlQuery, parameterSource, Long.class);

View File

@@ -154,28 +154,28 @@ public class DelegatingDataAccessStrategy implements DataAccessStrategy {
}
@Override
public <T> Optional<T> selectOne(Query query, Class<T> probeType) {
return delegate.selectOne(query, probeType);
public <T> Optional<T> findOne(Query query, Class<T> domainType) {
return delegate.findOne(query, domainType);
}
@Override
public <T> Iterable<T> select(Query query, Class<T> probeType) {
return delegate.select(query, probeType);
public <T> Iterable<T> findAll(Query query, Class<T> domainType) {
return delegate.findAll(query, domainType);
}
@Override
public <T> Iterable<T> select(Query query, Class<T> probeType, Pageable pageable) {
return delegate.select(query, probeType, pageable);
public <T> Iterable<T> findAll(Query query, Class<T> domainType, Pageable pageable) {
return delegate.findAll(query, domainType, pageable);
}
@Override
public <T> boolean exists(Query query, Class<T> probeType) {
return delegate.exists(query, probeType);
public <T> boolean exists(Query query, Class<T> domainType) {
return delegate.exists(query, domainType);
}
@Override
public <T> long count(Query query, Class<T> probeType) {
return delegate.count(query, probeType);
public <T> long count(Query query, Class<T> domainType) {
return delegate.count(query, domainType);
}
/**

View File

@@ -58,7 +58,7 @@ class FetchableFluentQueryByExample<S, R> extends FluentQuerySupport<S, R> {
@Override
public R oneValue() {
return this.entityOperations.selectOne(createQuery(), getExampleType())
return this.entityOperations.findOne(createQuery(), getExampleType())
.map(item -> this.getConversionFunction().apply(item)).get();
}
@@ -66,21 +66,21 @@ class FetchableFluentQueryByExample<S, R> extends FluentQuerySupport<S, R> {
public R firstValue() {
return this.getConversionFunction()
.apply(this.entityOperations.select(createQuery().sort(getSort()), getExampleType()).iterator().next());
.apply(this.entityOperations.findAll(createQuery().sort(getSort()), getExampleType()).iterator().next());
}
@Override
public List<R> all() {
return StreamSupport
.stream(this.entityOperations.select(createQuery().sort(getSort()), getExampleType()).spliterator(), false)
.stream(this.entityOperations.findAll(createQuery().sort(getSort()), getExampleType()).spliterator(), false)
.map(item -> this.getConversionFunction().apply(item)).collect(Collectors.toList());
}
@Override
public Page<R> page(Pageable pageable) {
return this.entityOperations.select(createQuery(p -> p.with(pageable)), getExampleType(), pageable)
return this.entityOperations.findAll(createQuery(p -> p.with(pageable)), getExampleType(), pageable)
.map(item -> this.getConversionFunction().apply(item));
}
@@ -88,7 +88,7 @@ class FetchableFluentQueryByExample<S, R> extends FluentQuerySupport<S, R> {
public Stream<R> stream() {
return StreamSupport
.stream(this.entityOperations.select(createQuery().sort(getSort()), getExampleType()).spliterator(), false)
.stream(this.entityOperations.findAll(createQuery().sort(getSort()), getExampleType()).spliterator(), false)
.map(item -> this.getConversionFunction().apply(item));
}

View File

@@ -142,7 +142,7 @@ public class SimpleJdbcRepository<T, ID>
Assert.notNull(example, "Example must not be null");
return this.entityOperations.selectOne(this.exampleMapper.getMappedExample(example), example.getProbeType());
return this.entityOperations.findOne(this.exampleMapper.getMappedExample(example), example.getProbeType());
}
@Override
@@ -159,7 +159,7 @@ public class SimpleJdbcRepository<T, ID>
Assert.notNull(example, "Example must not be null");
Assert.notNull(sort, "Sort must not be null");
return this.entityOperations.select(this.exampleMapper.getMappedExample(example).sort(sort),
return this.entityOperations.findAll(this.exampleMapper.getMappedExample(example).sort(sort),
example.getProbeType());
}
@@ -168,7 +168,8 @@ public class SimpleJdbcRepository<T, ID>
Assert.notNull(example, "Example must not be null");
return this.entityOperations.select(this.exampleMapper.getMappedExample(example), example.getProbeType(), pageable);
return this.entityOperations.findAll(this.exampleMapper.getMappedExample(example), example.getProbeType(),
pageable);
}
@Override