Archive for category SPRING DATA JPA

Change sort order for Spring Data findAll() method

 

List<Student> findAllByOrderByIdDesc();

IMPORTANT :
Since I’ve been told that it’s easy to miss the key point of this answer, here’s a little clarification:

findAllByOrderByIdAsc();

The little ‘by’ does all the magic

 

 

Advertisements

Leave a comment