I have 3 tables Consultant, Patient and Diagnosis.
(我有3张桌子顾问,患者和诊断。)
Diagnosis has attributes of both Consultant and Patient as foreign keys. (诊断具有作为外键的顾问和患者属性。)
I want to know how to show this in spring. (我想知道如何在春季展示这个。)
What i have so far is, Consultant.java
(到目前为止,我是Consultant.java
)
private String name;
private String pos;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "consultant")
private List<Diagnosis> diagnosis;
Diagnosis.java
public class Request {
private String token;
private String comment;
private boolean status;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "Patient_id")
@JoinColumn(name = "Consultant_id") //not sure about this syntax
private Consultant consultant;
private Patient patient;
Patient.java
private String name;
private int pid;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "patient")
private List<Diagnosis> diagnosis;
Please is this how to go about it?
(请这是怎么回事?)
Also Im using postgresql. (我也使用postgresql。)
PS I'm new to Spring framework
(PS我是Spring框架的新手)
ask by B.obed translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…