Nhibernate 是否从多对多引用表中删除项?

Nhibernate 是否从多对多引用表中删除项?,nhibernate,many-to-many,Nhibernate,Many To Many,我有两个表“组”和“客户”,当然还有两个实体“组”和“客户”。 还有一个表引用了“CustomerGroupMember”表 我使用CustomerGroupMember表进行多对多映射 Customer.hbm.xml <!--Many to many--> <bag name="CustomerGroups" table="CustomerGroupMember" cascade="all" lazy="true"> <key column=

我有两个表“组”和“客户”,当然还有两个实体“组”和“客户”。 还有一个表引用了“CustomerGroupMember”表

我使用CustomerGroupMember表进行多对多映射

Customer.hbm.xml

<!--Many to many-->
    <bag name="CustomerGroups" table="CustomerGroupMember" cascade="all" lazy="true">
      <key column="CustomerId" />
      <many-to-many class="CustomerGroup" column="CustomerGroupId" />
    </bag> 

Group.hbm.xml

<bag name="Members" table="CustomerGroupMember" cascade="all" lazy="true">
      <key column="CustomerGroupId" />
      <many-to-many class="Customer" column="CustomerId" />
</bag>

我还没有为“CustomerGroupMember”表创建实体和映射

我的问题是如何从CustomerGroupMember表中删除CustomerGroupMember? 我是否需要为CustomerGroupMember创建实体才能删除CustomerGroupMember,还是有其他方法


非常感谢。

要删除这些表之间的关系项,您应该能够以某种方式引用连接表中的确切行,这在当前映射中是不可能的。是的,您必须为
CustomerGroupMember
表创建实体和映射。如果没有映射,你怎么知道要删除哪一行?

正如我所想,再次感谢你,梅尔达:)我只是好奇是否有其他方法。非常感谢。