That's the problem with foobar code. It tends to oversimplify code (I tend to :)) Categories is virtual in Article and overridden in SubArticle. Still I get this error. I will post original code tomorrow.
On Thu, Oct 23, 2008 at 6:26 PM, Jon Palmer <[EMAIL PROTECTED]> wrote: > You should really have a new keyword on the definition of the Categories in > Bar or declare Categories as virtual in Foo and override in Bar. > Not sure if NHibernate deals with the first case but if defintiely handles > the second. > > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Jan > Limpens > Sent: Thursday, October 23, 2008 11:59 AM > To: [email protected] > Subject: [nhusers] Re: Found shared references to a collection > > > Bar is ... > > I have Product:Article and SubArticle:Article (among others). > SubArticles are Products that override (datawise) some properties, > like Name, Weight, Price (a SubArticle is essentially the Product in a > different quantity. If the Product comes in 50 units, there might be a > SubArticle that comes with 10 units, or 1). > > So actually they do SubArticle does not inherit from Product. The fact > that I pass it a Product as a parent is likely to change soon. Right > now only Product can have SubArticles. > > On Thu, Oct 23, 2008 at 4:40 PM, Jon Palmer <[EMAIL PROTECTED]> wrote: >> Why do you have Bar subclass Foo and also compose a Foo in the parent field? >> >> >> >> -----Original Message----- >> From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Jan >> Limpens >> Sent: Thursday, October 23, 2008 11:39 AM >> To: [email protected] >> Subject: [nhusers] Found shared references to a collection >> >> >> hi guys, >> >> i have a >> >> class Foo >> { >> IList Categories { get; set; } >> } >> >> and >> >> class Bar : Foo { >> public Bar(Foo parent) { this.parent = parent; } >> IList Categories { >> get {return parent.Categories;} >> set {parent.Categories = value; } } >> } >> >> when I try to hibernate this, I get a >> HibernateException: Found shared references to a collection: Foo.Categories >> >> which is true, but intended behavior. Can I somehow map around this? >> -- >> Jan >> ___________________ >> [EMAIL PROTECTED] >> www.limpens.com >> +55 (11) 3082-1087 >> +55 (11) 3097-8339 >> >> >> >> > >> > > > > -- > Jan > ___________________ > [EMAIL PROTECTED] > www.limpens.com > +55 (11) 3082-1087 > +55 (11) 3097-8339 > > > > > > -- Jan ___________________ [EMAIL PROTECTED] www.limpens.com +55 (11) 3082-1087 +55 (11) 3097-8339 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
