DATAJPA-48 - Added findAll(Specification, Sort) to JpaSpecificationExecutor.
Added implementation to SimpleJpaRepository.
This commit is contained in:
@@ -19,6 +19,7 @@ import java.util.List;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
|
||||
@@ -59,6 +60,17 @@ public interface JpaSpecificationExecutor<T> {
|
||||
Page<T> findAll(Specification<T> spec, Pageable pageable);
|
||||
|
||||
|
||||
/**
|
||||
* Returns all entities matching the given {@link Specification} and
|
||||
* {@link Sort}.
|
||||
*
|
||||
* @param spec
|
||||
* @param sort
|
||||
* @return
|
||||
*/
|
||||
List<T> findAll(Specification<T> spec, Sort sort);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of instances that the given {@link Specification} will
|
||||
* return.
|
||||
|
||||
@@ -285,6 +285,20 @@ public class SimpleJpaRepository<T, ID extends Serializable> implements
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.springframework.data.jpa.repository.JpaSpecificationExecutor#findAll
|
||||
* (org.springframework.data.jpa.domain.Specification,
|
||||
* org.springframework.data.domain.Sort)
|
||||
*/
|
||||
public List<T> findAll(Specification<T> spec, Sort sort) {
|
||||
|
||||
return getQuery(spec, sort).getResultList();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user