1
我遇到了與連接表映射多對多關係時遇到問題。我得到的消息errror是「集合元素映射具有錯誤的列數」在NHibernate連接表獲取「收集元素映射具有錯誤的列數」
我的數據庫架構基本上是: 。 儘管來自SQL Server Management Studio的圖片,數據庫是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>
我知道我做錯了什麼,但我不能弄明白。我究竟做錯了什麼?我如何解決它?