我正在使用 JPQL 实现 PostgreSQL 查询。
这是一个本机 psql 查询示例,
SELECT * FROM students ORDER BY id DESC LIMIT 1;
在 JPQL 中同样的查询不起作用,
@Query("SELECT s FROM Students s ORDER BY s.id DESC LIMIT 1")
Students getLastStudentDetails();
看起来 LIMIT 子句在 JPQL 中不起作用。
根据 JPA 文档,我们可以使用 setMaxResults/setFirstResult
,谁能告诉我如何在我上面的查询中使用它?