Hello,
I have a mapping problem with 3 tables:
Organization(OrganizationID)
Address(AddressID)
OrganizationAddress(OrganizationID, AddressID)
My mapping is:
Organization
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" assembly="Entities" namespace="Entities"> <class name="Entities.Organization, Entities" table="ORGANIZATION"> <id name="ID" column="ID" type="System.Int32"> <generator class="assigned"/> </id> <property name="ID" column="ID" type="System.Int32" update="false" insert="false" /> <property name="Name" column="Name" type="System.String" update="true" insert="true" /> <list name="OrganizationAddress" inverse="true"> <key column="OrganizationID" /> <index column="OrganizationID" /> <one-to-many class="OrganizationAddress" /> </list> </class> </hibernate-mapping>
Address
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" assembly="Entities" namespace="Entities"> <class name="Entities.Address, Entities" table="ADDRESS"> <id name="ID" column="ID" type="System.Int32"> <generator class="assigned"/> </id> <property name="ID" column="ID" type="System.Int32" update="false" insert="false" /> <property name="Street" column="Street" type="System.String" update="true" insert="true" /> <property name="Number" column="Number" type="System.String" update="true" insert="true" /> <list name="OrganizationAddress" inverse="true"> <key column="AddressID" /> <index column="AddressID" /> <one-to-many class="OrganizationAddress" /> </list> </class> </hibernate-mapping>
OrganizationAddress
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" assembly="Entities"
namespace="Entities"> <class name="Entities.OrganizationAddress, Entities"
table="ORGANIZATION_ADDRESS"> <composite-id> <key-property name="OrganizationID" column="OrganizationID" type="System.Int32" />
<key-property name="AddressID" column="AddressID" type="System.Int32" /> <key-many-to-one name="Organization" column="OrganizationID" /> <key-many-to-one name="Address" column="AddressID" /> </composite-id> </class> </hibernate-mapping>
I receive the error: Repeated column in mapping for collection:
Entities.Address.OrganizationAddress column: AddressID
Please HELP ME!
What is wrong in my mapping?
Thanks,
joxx
|