I have a product object that contains 2 collections, accessories and
consumers. Consumers relates to an accessory, the list of products
that consume it. In the database I have a many to many relationship
for these collections that is implemented as a linking table
Product_Accessory. In mapping I have created a many to many one way
for the accessories and the other way for consumers :
mapping.HasManyToMany<oProduct>(x => x.Accessories)
.Table("Product_Accessory")
.Cascade.SaveUpdate()
.ParentKeyColumn("ProductId")
.ChildKeyColumn("AccessoryId")
.AsBag();
mapping.HasManyToMany<oProduct>(x => x.Consumers)
.Table("Product_Accessory")
.Cascade.SaveUpdate()
.ParentKeyColumn("AccessoryId")
.ChildKeyColumn("ProductId")
.AsBag();
This all seems very logical but nHibernate is giving me an error of
Found shared references to a collection because there are two lists of
products.
Is this pattern possible using nHibernate? What is the best way to
achieve this?
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.