I\'m using Spring Data JPA and I wonder if it is possible to change the default sort order for a entity being used by the Spring Data findAll() method?
findAll()
Use a PagingAndSortingRepository instead. With that in place you can add a queryparameter ?sort=,
Repository:
public interface UserRepository extends PagingAndSortingRepository { //no custom code needed }
GET Request:
localhost:8080/users?sort=name,desc