Quick Start - Step 4 Quick Start - Step 4

Add a teacher reference to pupil

It is easy to make a pupil to have a reference to a teacher. Add the next code to Pupil class :

@ManyToOne
private Teacher teacher;

public Teacher getTeacher() {
    return teacher;
}

public void setTeacher(Teacher teacher) {
    this.teacher = teacher;
}

Deploy it:

Go to http://localhost:8080/MySchool/modules/Pupil and select detail mode: