I am calling repository by id and pageRequest parameters but I cannot manage to sort the result. I call my repository in service layer as follow:
Sort sort = new Sort(Sort.Direction.DESC, "dateTime");PageRequest pageRequest = new PageRequest(0, 10, sort) ;repository.findById(id, pageRequest);
And here is my repository class:
public interface QueryResultRepository extends CrudRepository<QueryResult, String>{ Page<QueryResult> findById(String id, Pageable pageable);}
Entity Class:
@RedisHash("queryresultdataredis")public class QueryResultDataRedis { @Id private String id = null; @Indexed private String queryId = null; private String name;