Hibernate对象关系映射总结(5)

2021-02-21 12:35

Hibernate对象关系映射总结

@Entity@Table(name="t_jpa_Student1") public class Student1{ private int id; private String name; private Set<Teacher1> teachers= new HashSet<Teacher1>();@ManyToMany(mappedBy="students") public Set<Teacher1> getTeachers(){ return teachers;} public void setTeachers(Set<Teacher1> teachers){ this.teachers= teachers;}………………………………….}

@Entity@Table(name="t_jpa_teacher1") public class Teacher1{ private int id; private String name; private Set<Student1> students= new HashSet<Student1>();@ManyToMany@JoinTable(name="t_jpa_teacher_student", joinColumns={@JoinColumn(name="teacher_id")}, inverseJoinColumns={@JoinColumn(name="student_id" )} ) public Set<Student1> getStudents(){ return students;} public void setStudents(Set<Student1> students){ this.students= students;}………………………………….}

一对多单向关联:用户组用户

用户组知道自己有哪些用户:通过 groupid就能查询到用户

用户不知道自己所于哪个用户组


Hibernate对象关系映射总结(5).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:(√)2018年安全生产、防护、文明施工费用年度使用计划

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: