【发布时间】:2020-04-06 13:29:17
【问题描述】:
我正在尝试编写“existsBy”查询,但无法使其工作。我知道JpaRepository 中有一个existByID,但我需要通过属性student_id 进行检查。我尝试了无数种写函数名的方法,但我似乎无法正确。
public class Student implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
private long student_id;
+other fields and getters and setters...
@Repository
public interface StudentRepository extends JpaRepository<Student, Long> {
boolean existsByStudentid(Long student_id);
}
错误:
Caused by: org.springframework.data.mapping.PropertyReferenceException: No property student found for type Student!
【问题讨论】:
标签: mysql spring spring-boot jpa