且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用相同的数据透视表使用子类休眠多对多

更新时间:2021-11-22 08:56:16

在您的集合中,您可以添加过滤器:

In your set you can add a filter:

<set name="CollegeStudents" table="tstudent_course"
            inverse="true">
    <key>
        <column name="id_course" not-null="true" />
    </key>
    <many-to-many entity-name="CollegeStudent" where="person_type='COLLEGE_STUDENT'">
        <column name="id_person" not-null="true" />
    </many-to-many>
</set>

恕我直言,如果没有该过滤器(只有一组学生),映射会更好.

IMHO the mapping would be better without that filter (just a set of all students).