Quote:
The objects should only be considered equal if all the fields are equal (the fields were omitted in the example), not if ParentId is equal
This is what i would call a value-type, in nHibernate this is done using components as described in the reference manual chapter 7
You can easily make it work like you describe by mapping your parent class like this(the Child class is now a "component" instead of a class this way it has no life of its own in nHibernates eyes)
Code:
<class name="Parent" lazy="false" table="parent">
<id name="Id">
<column name="id" not-null="true" />
<generator class="assigned" />
</id>
<set name="Children" table="children">
<key column="parent_id"/>
<composite-element class="Child">
<property name="Name" />
</composite-element>
</set>
</class>
I added name as an example for your components properties, it can of course have multiple properties.
Hope this helps