spring data jpa 外键驼峰命名失效

有下列实体类:

@Data
@Table(name = "doctors_doctor")
@NoArgsConstructor
public class Doctor implements Serializable {
    @Id
    private Integer id;
    private String name;
    private String sex;
    private String idCard;
    private String email;
    private Long mobile;
    private LocalDate birthday;
    private String avatar;
    private String username;
    private String password;
    private Boolean isVerified;
    private Integer department_id;
    private Integer hospital_id;
    private Integer title_id;
    private Integer ethnic_id;

}

数据库列名:

当外键字段使用驼峰命名时就报错

Caused by: org.springframework.beans.NotReadablePropertyException: Invalid property 'department_id' of bean class [com.fengyun.medical.pojo.domain.Doctor]: Could not find field for property during fallback access!

有知道原因的大神留言下



来自为知笔记(Wiz)


posted on 2022-11-01 11:31  白衣风云  阅读(177)  评论(0编辑  收藏  举报

导航