【发布时间】:2020-06-25 17:55:49
【问题描述】:
我有一个包含两条记录的 jpa 查询,我无法在 jpql 中使用 @query 从两条记录中选择第一条记录
这是我的sn-p
@Query("select h from History h where h.id =:id and h.status =:status " +
"and h.type =:type and h.user =:user")
History getAHistory(@Param("id") Long id, @Param("status") Status status,
@Param("type") Type type, @Param("user") User user);
根据调查结果,我正在尝试使用 LIMIT 1 但没有成功
【问题讨论】:
-
这能回答你的问题吗? Limit number of results in JPQL
-
不,它没有。
标签: java jpa spring-data-jpa jpql