Taking a good example that's provided around the Fluent nHibernate website, I have to extend it slightly:

alt text

I have to give a 'Quantity' column towards the StoreProduct table. Wouldso would I map this using nHibernate?

A good example mapping is supplied for that given scenario above, but I am unsure the way i would obtain the Quantity column to map to some property around the Product class:

public class StoreMap : ClassMap<Store>
{
  public StoreMap()
  {
    Id(x => x.Id);
    Map(x => x.Name);
    HasMany(x => x.Employee)
      .Inverse()
      .Cascade.All();
    HasManyToMany(x => x.Products)
     .Cascade.All()
     .Table("StoreProduct");
  }
}

One suggestion is always to not make use of the hasManyToMany mapping and also have a separate mapping class for StoreProduct the industry subclass of Product.

New Store Mapping

public class StoreMap : ClassMap<Store>
{
  public StoreMap()
  {
    Id(x => x.Id);
    Map(x => x.Name);
    HasMany(x => x.Employee)
      .Inverse()
      .Cascade.All();
    HasMany(x => x.Products)
     .Cascade.All();
  }
}

NB transformed HasManyToMany to HasMany rather.

New sub class mapping for Store Product

public class StoreProductMap : SubclassMap<StoreProduct>
{
   References(x=>x.Store);

   Map(x=>x.Quantity);
}

New StoreProduct entity

public class StoreProduct : Product
{
    public Store Store {get;set;}
    public int Quantity {get;set;}
}

Hope that can help.