Using the following mapping file, I get the following error:
DomainModelSpike.ItemDbTests.TestGetItems : NHibernate.MappingException : Repeated column in mapping for collection: DomainModelSpike.Supplier.Items column: site_id
TearDown : System.NullReferenceException : Object reference not set to an instance of an object.
Why can't site_id exist for both key and the many to many column mappings?
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="DomainModelSpike.Supplier, DomainModelSpike" table="Supplier">
<composite-id>
<key-property name="SiteId" column="site_id" />
<key-property name="Id" column="supplier_id" />
</composite-id>
<set name="Items" lazy="true" table="ItemSupplier" >
<key>
<column name="site_id"/>
<column name="supplier_id"/>
</key>
<many-to-many class="DomainModelSpike.Item, DomainModelSpike">
<column name="site_id"/>
<column name="item_id"/>
</many-to-many>
</set>
</class>
</hibernate-mapping>
Any help that anybody could provide would be appreciated.
|