我有一个如下所示的查询,
@Query("select p from Product p where p.title like concat ('%',?1,'%') and p.categoryId = ?2")
如何使用订单依据? 我尝试遵循它给了我语法异常
@Query("select p from Product p where p.title like concat ('%',?1,'%') and p.categoryId = ?2" order by createddate desc)
预先感谢您的帮助。
最佳答案
如果创建日期是产品字段,请尝试:
@Query("select p from Product p where p.title like concat ('%',?1,'%') and p.categoryId = ?2 order by p.createddate desc")
关于java - spring jpa中查询是按关键字查找时如何使用order by,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37039749/