简体   繁体   中英

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 |

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM