With the following tables:

Products:

   - Id (PK) ...

Categories:

   - Id (PK) ...

ProductCategories:

   - ProductId (PK)
   - CategoryId (PK)
   - Price ...

Audits:

   - Id (PK)
   - DateCreated

ProductCategoryAudits

   - Id (PK, FK to Audits.Id)
   - ProductId (FK to Products.Id)
   - CategoryId (FK to Categories.Id)

The Products, Categories and Audits are self explanatory. The 
ProductCategories table has a composite Id on the ProductId and CategoryId 
fields. The ProductCategoryAudits table is mapped as a subclass and it's 
parent is the Audits table. This is important as I have tested this with 
and without a subclass and the issue only arises when referencing the 
composite Id on a subclass.

ProductCategoryAudits references the ProductCategory via a single property 
(called Entity) in my class. This is mapped like so:

public class ProductCategoryAuditMap : SubclassMap {
  public ProductCategoryAuditMap() {
    Table("ProductCategoryAudits");
    KeyColumn("Id");
    References(x => x.Entity).Columns("ProductId", "CategoryId");
  }
}

However this generates the following XML for the Entity property:

<many-to-one class="ProductCategory" name="Entity">
  <column name="ProductId" />
</many-to-one>

Notice it only added the ProductId column and not the CategoryId aswell.

"This topic was originally created by nfplee on 
https://github.com/jagregory/fluent-nhibernate/issues/194 , but it wasnt 
fixed yet. =(("

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/fluent-nhibernate/-/OerxZRl-PNsJ.
To post to this group, send email to fluent-nhibernate@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to