在NHibernate中连接表得到;集合元素映射的列数错误“;

在NHibernate中连接表得到;集合元素映射的列数错误“;,nhibernate,join,nhibernate-mapping,Nhibernate,Join,Nhibernate Mapping,我无法将多对多关系映射到联接表。我收到的错误消息是“集合元素映射的列数错误” 我的数据库模式基本上是: . 尽管有来自SQLServerManagementStudio的图片,但数据库是Sqlite 我的映射文件是: <?xml version="1.0" encoding="utf-8"?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <class name="Design" table="De

我无法将多对多关系映射到联接表。我收到的错误消息是“集合元素映射的列数错误”

我的数据库模式基本上是: . 尽管有来自SQLServerManagementStudio的图片,但数据库是Sqlite

我的映射文件是:

<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">

<class name="Design" table="Design">
  <id name="DesignID" column="DesignID" type="Int32">
    <generator class="native"/>
  </id>
  <property name="Name" type="String" column="Name" />
  <property name="DisplayOrder" type="Int32" column="DisplayOrder" />
  <property name="ChangeDate" column="ChangeDate" type="DateTime"/>
  <set name="DesignMeasures" table="DesignProperties" cascade="save-update,delete-orphan" >
    <key column="DesignID" />
    <many-to-many column="PropertyID" class="DesignProperties" unique="true" />
  </set>
</class>

  <class name="Properties" table="Properties">
    <id name="PropertyID" column="PropertyID" type="Int32">
      <generator class="native" />
    </id>
    <property name="Name" type="String" column="Name" />
    <property name="Value" type="String" column="Value" />
  </class>

  <class name="DesignProperties" table="DesignProperties">
    <composite-id>
      <key-many-to-one class="Design" name="DesignID" column="DesignID" />
      <key-many-to-one class="Properties" name="PropertyID" column="PropertyID" />
    </composite-id>
  </class>

</hibernate-mapping> 


我知道我做错了什么,但我想不出来。我做错了什么?如何修复它?

DesignProperties要么是多对多关系,要么是实体,而不是两者

由于它没有自己的任何属性,我将删除DesignProperties类及其映射,并在
设计中保留
属性的集合(不是属性;您的类名应该是单数)