Spring JPA - 查找并排序[重复]

2024-01-13

我有一个竞赛实体:

@Entity
@Table(name = "T_CONTEST")
public class Contest { 

    //rest of the attributes

    @Column(name = "START_TIME")
    private LocalDateTime start;

    @Column
    @Enumerated(EnumType.STRING)
    private ContestStatus status;
}

我想要获得最近开始时间且状态=待处理的第一场比赛。 我知道这可以使用自定义查询来完成,但是执行此操作的正确 Spring JPA 方法是什么? 我尝试遵循,但这是不正确的。

Contest findTopByOrderByStartAndStatusDesc(ContestStatus status);

你试过了吗

findTopByContestStatusOrderByStartDesc(ContestStatus status)

?

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Spring JPA - 查找并排序[重复] 的相关文章

随机推荐