In previous posts I explained how you can use Spring Data JPA to create repositories that support custom queries, as well as to support paging in your app. You might wonder whether you can use these together.
The answer is yes. It works just like you would expect:
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
public interface IncidentRepo extends JpaRepository<Incident, Long> {
Page<Incident> findByProblemId(Long problemId, Pageable pageable);
}

By Spring » Agile Mobile Developer July 7, 2012 - 8:50 pm
[...] developer tools and moreTechCast #71 – Brian Fox of Sonatype on Nexus 2 Spring In PracticePageable custom queries with Spring Data JPAHow to run JavaScript from JavaInjecting a file from the classpath into a beanPagination and sorting [...]
By tommy January 26, 2013 - 8:56 am
help me!
I’m use “Page findByState(byte state, Pageable pageable)”, but result is very strange:
the page.getTotalElements is right, but the page.getContent() is empty.