多对多
关系表不需要实体类
实力类-----------------------
Teacher
private Set students=new HashSet();
Student
private Set teachers=new HashSet();
提供get、set方法
映射文件--------------------
Teacher
<set name="students" cascade="all" inverse="true" table="t_s">
<!--table: 将teacher和student的关系映射到第三方表 table="关系表"-->
<ket column="tid"></key> <!--通过tid找自己的老师(在哪个映射就写哪个id)-->
<many-to-many class="com.yps.entity.Student" column="sid"></many-to-many>
<!--学生通过sid和tid在关系表映射-->
</set>
Student
<set name="teachers" table="t_s">
<key column="sid"></key>
<many-to-many class="com.yps.entity.Teacher" column="tid"></many-to-many>
</set>