David Vincent
David Vincent

Reputation: 644

SDN4 - cannot orderBy object from repository

After update to Spring Data Neo4j 4.1.3 RELEASE, I cannot use OrderBy. For example I call findByIdOrderByNoAsc(String id)

I need to use workaround and create a Collection.sort method just for this purpose. In Spring Data Neo4j 3 still work fine, but after update, I just realize that my List of object, is not ordered Ascending or Descending.

This is my Repository :

package com.sample.repository;

import java.util.List;

import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.GraphRepository;

import com.sample.model.Item;

public interface ItemRepository extends GraphRepository<Item> {

    Item findByIdOrderByNoAsc(String id);

}

Is SDN4 already not support this kind of function? How can I sort my Object from Repository without using Pageable?

Upvotes: 1

Views: 88

Answers (1)

Luanne
Luanne

Reputation: 19373

SDN 4 does not yet support the static *orderBy for derived finders, but you could use the org.springframework.data.domain.Sort till this is supported

e.g.

List<Cinema> findByLocation(String city, Sort sort);

Upvotes: 1

Related Questions