Issue of pagination in Spring Data JPA
make sure that you are importing Pageable object from : org.springframework.data.domain.Pageable;
You are reading the error message wrong:
Paging query needs to have a Pageable parameter!
The methods you have commented out are correct, the remaining ones are wrong! If you want to return Page<PSubject>
from a query method, this method must have Pageable
argument. This is understandable: if you are asking about specific page of results, you must first define which page are you interested in.
Page<PSubject> findByType(String type, Pageable pageable);
Page<PSubject> findByType(String type, Pageable pageable);
Page<PSubject> findByMacaddress(String macaddress, Pageable pageable);
Page<PSubject> findByMacaddress(String macaddress, Pageable pageable);
Page<PSubject> findByUri(String uri, Pageable pageable);
Or you if you are interested about all results use List<PSubject>
:
Page<PSubject> findByType(String type, Pageable pageable);
List<PSubject> findByType(String type);
Page<PSubject> findByMacaddress(String macaddress, Pageable pageable);
List<PSubject> findByMacaddress(String macaddress);
List<PSubject> findByUri(String uri);