Hibernate version:1.0.2.0
Mapping documents: <?xml version="1.0" encoding="utf-16"?> <hibernate-mapping xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:nhibernate-mapping-2.0"> <class name="Model.Person, Model" table="Person" lazy="false"> <id name="Id" access="nosetter.camelcase-underscore" column="Id" type="Int32" unsaved-value="0"> <generator class="identity"> </generator> </id> <property name="Firstname" access="property" column="Firstname" type="String" /> <property name="Lastname" access="property" column="Lastname" type="String" /> <set name="Organisations" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics" table="OrganisationEmployee" lazy="true" inverse="true"> <key column="PersonID" /> <many-to-many class="Model.Organisation, Model" column="OrganisationID" /> </set> </class> </hibernate-mapping>
<?xml version="1.0" encoding="utf-16"?> <hibernate-mapping xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:nhibernate-mapping-2.0"> <class name="Model.Organisation, Model" table="Organisation" lazy="false"> <id name="Id" access="nosetter.camelcase-underscore" column="Id" type="Int32" unsaved-value="0"> <generator class="identity"> </generator> </id> <property name="Name" access="property" column="Name" type="String" /> <set name="Employees" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics" table="OrganisationEmployee" lazy="true"> <key column="OrganisationID" /> <many-to-many class="Model.Person, Model" column="PersonID" /> </set> </class> </hibernate-mapping>
<?xml version="1.0" encoding="utf-16"?> <hibernate-mapping xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:nhibernate-mapping-2.0"> <class name="Model.OrganisationEmployee, Model" table="OrganisationEmployee" lazy="false"> <id name="Id" access="nosetter.camelcase-underscore" column="Id" type="Int32" unsaved-value="0"> <generator class="native"> </generator> </id> <property name="Email" access="property" column="Email" type="String" /> <many-to-one name="Person" access="property" class="Model.Person, Model" column="PersonID" /> <many-to-one name="Organisation" access="property" class="Model.Organisation, Model" column="OrganisationID" /> <set name="Appointments" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics" table="AppointmentContact" lazy="true" inverse="true"> <key column="OrganisationEmployeeID" /> <many-to-many class="Model.Appointment, Model" column="AppointmentID" /> </set> </class> </hibernate-mapping>
<?xml version="1.0" encoding="utf-16"?> <hibernate-mapping xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:nhibernate-mapping-2.0"> <class name="Model.Appointment, Model" table="Appointment" lazy="false"> <id name="Id" access="nosetter.camelcase-underscore" column="Id" type="Int32" unsaved-value="0"> <generator class="identity"> </generator> </id> <property name="Startdate" access="property" column="Startdate" type="System.DateTime" /> <property name="Enddate" access="property" column="Enddate" type="System.DateTime" /> <set name="Contacts" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics" table="AppointmentContact" lazy="true"> <key column="AppointmentID" /> <many-to-many class="Model.OrganisationEmployee, Model" column="OrganisationEmployeeID" /> </set> </class> </hibernate-mapping>
Full stack trace of any exception that occurs:NHibernate.MappingException: Foreign key in table AppointmentContact must have same number of columns as referenced primary key in table OrganisationEmployee at NHibernate.Mapping.ForeignKey.set_ReferencedTable(Table value) at NHibernate.Cfg.Configuration.SecondPassCompileForeignKeys(Table table, ISet done)
Name and version of the database you are using:MS SQL Express 2005
Hi, I get this error when i try to use an association table which also has properties of its in a many-to-many relation. I have tried a lot of different mappings but I can't get this to work. Does somebody know how I can solve this issue?
|