如何将 OrderBy 与 GreaterThan Spring JPA 一起使用
How to use OrderBy with GreaterThan Spring JPA
我想在我的 Repository 接口中添加一个方法,该方法可以找到大于 long publishdata
值的所有数据并按递减方式对其进行排序:
我试过了,但似乎不起作用:
@Repository
public interface NoticiaRepository extends CrudRepository<Noticia,Long>{
Noticia findById(long id);
List<Noticia> findByOrderPublishdateGreaterThanDesc(long publishdate);
}
List<Noticia> findByPublishdateGreaterThanOrderByPublishdateDesc(Long publishdate)
我想在我的 Repository 接口中添加一个方法,该方法可以找到大于 long publishdata
值的所有数据并按递减方式对其进行排序:
我试过了,但似乎不起作用:
@Repository
public interface NoticiaRepository extends CrudRepository<Noticia,Long>{
Noticia findById(long id);
List<Noticia> findByOrderPublishdateGreaterThanDesc(long publishdate);
}
List<Noticia> findByPublishdateGreaterThanOrderByPublishdateDesc(Long publishdate)