如何将OrderBy与GreaterThan Spring JPA一起使用

时间:2016-02-29 22:40:01

标签: java spring jpa repository

我想在我的Repository界面中添加一个方法,该方法可以找到大于long publishdata值的所有数据并按顺序排序:

我试过这个,但它似乎没有起作用:

@Repository
public interface NoticiaRepository extends CrudRepository<Noticia,Long>{

    Noticia findById(long id);
    List<Noticia> findByOrderPublishdateGreaterThanDesc(long publishdate);

}

1 个答案:

答案 0 :(得分:16)

List<Noticia> findByPublishdateGreaterThanOrderByPublishdateDesc(Long publishdate)