I have such mapping for ProductVariant table:
Id(x => x.Id).Nullable();
Map(x => x.IsEnabled);
Map(x => x.ProductVariantName).Length(45);
Map(x => x.Description);
HasMany(x => x.TestCaseOrdered);
Map(x => x.CreatedDate);
And TestCaseOrder class like this one:
CompositeId().KeyReference(x => x.TestCaseData).KeyReference(x => x.ProductVariant);
Map(x => x.TestCaseOrder);
Map(x => x.TestCaseSetName).Length(45);
But NHibernate generates table TestCaseOrder with two ProductVariant columns:
1) ProductVariant with Primary Key and Not Null.
2) ProductVariantId like a foreign key to the ProductVariant table.
They always have the same data
But I need only one field. How can I achieve that?
seems like a conventionmismatch. Specifying
HasMany(x => x.TestCaseOrdered).KeyColumn("ProductVariantId");and.KeyReference(x => x.ProductVariant, "ProductVariantId");should solve it