hi

i have atable which has  2 many-to-one relations with another 2 tables

where the Pks for this table are the foreign key of the other 2
tables

this is the mapping :

        <class name="Project" table="Project" lazy="false" >
                <id name="ProjectId" column="ProjectId" type="Int32">
                                                <generator class="native"/>
                </id>
                <set name="Assignments" lazy="true" inverse="true" 
cascade="save-
update" >
                        <key>
                                <column name="ProjectId"/>
                        </key>
                        <one-to-many class="Assignment"/>
                </set>
        </class>

==========================================================
        <class name="Resource" table="Resource" lazy="false" >
                <id name="ResourceId" column="ResourceId" type="Int32">
                                                <generator class="native"/>
                </id>
                <set name="Assignments" lazy="true" inverse="true" 
cascade="save-
update" >
                        <key>
                                <column name="ResourceId"/>
                        </key>
                        <one-to-many class="Assignment"/>
                </set>
        </class>

===================================================================

and there the class where the problem appear :

        <class name="Assignment" table="Assignment" lazy="false" >
                <composite-id name="AssignmentId" class="AssignmentId" >
                        <key-property name="ProjectId" column="ProjectId" 
type="Int32"   />
                        <key-property name="ResourceId" column="ResourceId" 
type="Int32" />
                </composite-id >

        </class>


i get this error :

could not insert: [ManyTest.Entities.Assignment][SQL: INSERT INTO
Assignment (ProjectId, ResourceId) VALUES (?, ?)]

{"The INSERT statement conflicted with the FOREIGN KEY constraint
\"Project_Assignment\". The conflict occurred in database \"Many\",
table \"dbo.Project\", column 'ProjectId'.\r\nThe statement has been
terminated."}


any help?



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to