Hi,
I have 2 associated classes. Each has a legacy composite-key
where the fields are different from each other...
(this is a db that we have no control over :( )...
I thought the way would be to use property-ref for the many-to-one
and one-to-one mappings and possibly use a component to create the property of the foreign key for
MarketerSegment - MarketerSegmentContact
I'm getting the following error:
Code:
NHibernate.MappingException: property mapping has wrong number of columns:
Am I even close?
MarketerSegment - MarketerSegmentContact
Marketer Key [TagIndex]
[TagMSIndex]
MarketerSegmentContact Key[TagIndex]
[TagContactIndex]
MarketerSegment FK to MarketerSegmentContact[TagIndex]
[ContactIndex]
MarketerSegment key:Code:
<composite-id name="Id" class="CommonSegmentKey">
<key-property name="TagIndex" column="TagIndex"/>
<key-property name="Sequence" column="TagMSIndex"/>
</composite-id>
MarketerComponentMapping:Code:
<component name="ContactKey"
class="Domain.ContactInformationKey, Domain">
<property name="TagIndex" column="TagIndex" />
<property name="Sequence" column="ContactIndex"/>
</component>
MarketerContact Key:Code:
<composite-id name="Id" class="ContactInformationKey">
<key-property name="TagIndex" column="TagIndex"/>
<key-property name="Sequence" column="TagContactIndex"/>
</composite-id>
I'm trying to map the relationship in each file and I am not getting very far...
MarketerSegmentContact mapping:Code:
<many-to-one name="MarketerSegment" class="MarketerSegment"
property-ref="ContactKey"/>
MarketerSegment mapping to MarketerSegmentContactCode:
<one-to-one name="Contact" class="MarketerSegmentContact" property-ref="MarketerSegment" />