DATAJPA-48 - Added findAll(Specification, Sort) to JpaSpecificationExecutor.

Added implementation to SimpleJpaRepository.
This commit is contained in:
Oliver Gierke
2011-04-11 15:15:51 +02:00
parent 6ab4599bd5
commit c4a71140c9
2 changed files with 26 additions and 0 deletions

View File

@@ -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.

View File

@@ -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)
*