Skip to content

Support findAll with sorting in derived query methods #2080

Closed
@Thunderforge

Description

@Thunderforge

Consider this POJO code:

@RedisHash("somehash")
public class Example {

    @Id
    private String id;
    @Indexed
    private String some;
    @Indexed
    private String thing;
    @Indexed
    private Integer rank;

The following code would be expected to return elements sorted:

@Repository
public interface ExampleRepository extends CrudRepository<Example, string> {
    List<Example> findAllOrderByRank(Integer rank);
}

As described in this StackOverflow post) and corroborated by several users in the comments (and my own project), this does return all elements, but they are not sorted as expected. Indeed, the table of supported keywords inside method names does not list OrderBy as a valid keyword.

The section for Query By Example also specifically says that findAll with sorting is not supported.

This is important functionality that I would like to see supported in future releases.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions