目标是检索给定 UAI(枚举)的最后一个实体。不确定在 Spring Data JPA 中最好的方法是什么,这是我尝试过的(不起作用)
我的实体
public class AdmisHistory {
// stuffs (id etc..)
private Date jobExecutionDate;
@Enumerated(EnumType.STRING)
private UAI uai;
// getters / setters
}
我的 JPA 存储库:
public interface AdmisHistoryRepository extends CrudRepository<AdmisHistory, Long> {
public AdmisHistory findFirstByOrderByUaiByJobExecutionDateDesc(UAI uai);
}
错误:
Caused by: org.springframework.data.mapping.PropertyReferenceException: No property byJobExecutionDate found for type UAI! Traversed path: AdmisHistory.uai.
qq_花开花谢_0
相关分类