jeudi 26 mars 2015

Need to connect a relational table to a separate table



Requirement is to students attend courses and each student is able to select to attend which course in which institutions. As you can see student 1 has chosen to attend courses A and B and want to attend course A in institution I1 and I2.



Student
1
2
3

Course
A
B
C

Student_Course
1 A
1 B
2 A
3 C

School
Student Course Institution
1 A I1
1 A I2
1 B I6
2 A I5
3 C I3


Entities



@Entity
public class Student {
@Id
long id;
@ManyToMany
List<Course> courses;
...
}

@Entity
public class Course {
@Id
long id;
}

@Entity
public class Institution {
?????
}



Aucun commentaire:

Enregistrer un commentaire