I have a Contest entity:
@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;
}
I want to get the first contest with most recent start time AND status=PENDING. I know this can be done using a custom query, but what is the correct Spring JPA method to do this? I tried following but it's incorrect.
Contest findTopByOrderByStartAndStatusDesc(ContestStatus status);