spetrosiuk
spetrosiuk

Reputation: 13

Hibernate: How to annotate three tables in one join table?

How to annotate it?

Tables:

GROUPS

id | int |

name | text |

TEACHERS

id | int |

name | text |

SUBJECTS

id | int |

name | text |

I need to annotate them with

GROUP_SUBJECT_TEACHER

id_group | int |

id_subject | int |

id_teacher | int |

Upvotes: 1

Views: 118

Answers (1)

MohamadAbdelfatah
MohamadAbdelfatah

Reputation: 152

GROUP_SUBJECT_TEACHER will be mapped as an Entity called GroupSubjectTeacher:

each of Group, Teacher and Subject will have OneToMany relationship with GroupSubjectTeacher and GroupSubjectTeacher will have ManyToOne relationship with each of other entities

if you need more explanation, don't hesitate to ask

Upvotes: 1

Related Questions