I\'ve crossed posted this in the FNH Google Group but here\'s the scoop:
I have a table in a legacy database that has a composite ID. Well, the PK is implied since t
Figured it out. You don't need to add the reference property for the parent. Notice how the many-to-one is missing in the adjusted mapping:
public AttachmentMap()
{
SchemaIs(Resources.CityworksDatabaseSchema);
WithTable(ObjectNames.TableWorkorderAttachment);
UseCompositeId()
.WithKeyReference(x => x.ParentWorkorder, "WORKORDERID")
.WithKeyProperty(x => x.FileLocation, "IMAGEPATH");
Map(x => x.AttachedByUser, "ATTACHEDBY").WithLengthOf(100).Nullable();
Map(x => x.AttachedOn, "DATETIMEATTACHED").Nullable();
Map(x => x.Comments).Nullable().WithLengthOf(256);
//References(x => x.ParentWorkorder, "WORKORDERID").FetchType.Join();
}
This results in the following HBM mapping file. The fix is to have the composite-id have a key-many-to-one line pointing back to the parent class. Now I can persist my Attachment class.