Hi! I am new to the group and would appreciate your help.
In the project that I am currently working on we have separate tables per subclass for all sub-classing domain entities. I am currently faced with a mapping issue where NHibernate throws an "NHibernate.DuplicateMappingException: Duplicate collection role mapping" exception is thrown when it tries to load a subclass of a parent class containing a many-to-many relationship. Here is an example of what I am working with: ///Tables CREATE TABLE [dbo].[StoreVendor]( [Id] [int] IDENTITY(1,1) NOT NULL, [StoreId] [int] NOT NULL, [VendorId] [int] NOT NULL) CREATE TABLE [dbo].[OnlineStoreVendor]( [Id] [int] IDENTITY(1,1) NOT NULL, [OnlineStoreId] [int] NOT NULL, [VendorId] [int] NOT NULL) CREATE TABLE [dbo].[GiantStoreVendor]( [Id] [int] IDENTITY(1,1) NOT NULL, [GiantStoreId] [int] NOT NULL, [VendorId] [int] NOT NULL) ///Domain Entites public class Store : Entity { public virtual string Name {get; set;} public virtual IList<Vendor> Vendors {get; set;} } public class OnlineStore : Store { public virtual WebAddress Url {get; set; } public class GiantStore : Store { public virtual Address Location {get; set;} } ///Mapping overrides public class StoreMap : IAutoMappingOverride<Store> { public virtual void Override(AutoMapping<Store> mapping) { mapping.HasManyToMany(x => x.Vendors).Table("StoreVendor").Cascade.All(); } } public class OnlineStoreMap : IAutoMappingOverride<OnlineStore> { public virtual void Override(AutoMapping<OnlineStore> mapping) { mapping.HasManyToMany(x => x.Vendors).Table("OnlineStoreVendor").Cascade.All(); } } public class GiantStoreMap : IAutoMappingOverride<GiantStore> { public virtual void Override(AutoMapping<GiantStore> mapping) { mapping.HasManyToMany(x => x.Vendors).Table("GiantStoreVendor").Cascade.All(); } } How would I achieve this kind of thing using Fluent Nhibernate? Regards, Vern -- You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to fluent-nhibern...@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.