I disagree, the current implementation is exactly right. In a normal situation your table has only data that is mapped in NHibernate (ie all the values of the discriminator column are mapped to some class). Now if I perform a query for the base class I DON'T want NHibernate to put in an spurious where clause which will be true for all rows in the table.
I think its right that it works the way it does and you have to employ a work around in your legacy data case. Jon -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Lin Sent: Friday, September 26, 2008 11:51 AM To: nhusers Subject: [nhusers] Re: Discriminator bug you could use where clause, filters, views or create a dummy subclass. my point is, it should include the discriminator column in the select clause, so that users don't have to resort to these work arounds. having built several ORM in the past, that's how I would do it. If anyone knows which file to look at, I'm happy to take a look and make a patch for it. peter On Sep 26, 2:40 pm, "Tuna Toksöz" <[EMAIL PROTECTED]> wrote: > I think this is where filters come into play? > > On Fri, Sep 26, 2008 at 9:31 PM, Jon Palmer <[EMAIL PROTECTED]>wrote: > > > > > > > Can't you just specify a Where clause in the definition of the single > > class mapping. > > > -----Original Message----- > > From: [email protected] [mailto:[EMAIL PROTECTED] On > > Behalf Of Peter Lin > > Sent: Friday, September 26, 2008 11:29 AM > > To: nhusers > > Subject: [nhusers] Re: Discriminator bug > > > the reason is simple. what if I'm reading data from an existing > > database, which uses the concept of a discriminator with > > address_type_code. what if the address table has entries with > > different address_type_code values? > > > If I only want to get a specific type of address from the database and > > I don't have a subclass, NHibernate wouldn't return the correct > > result. It would return all rows, instead of just the rows with the > > specific address_type_code. > > > I just looked at the release notes for NH 2.0 and it looks like this > > scenario is supported. > > > Added [ Table per subclass, using a discriminator ] Support to > > Nhibernate > > >http://ayende.com/Blog/archive/2008/03/31/NHibernate-2.0-Alpha-is-out.as > > px > > > unfortunately, I can't upgrade to NH 2.0. I understand NH might not > > consider this a valid use case, but I definitely consider it a valid > > use case. > > > peter > > > On Sep 26, 11:20 am, "Fabio Maulo" <[EMAIL PROTECTED]> wrote: > > > Why you think that it is a bug ?If a class don't have a <subclass> > > (mean you > > > have only one value for discriminator and that mean don't have nothing > > to > > > discriminate), why NH must add the discriminator clause ? > > > > 2008/9/26 Peter Lin <[EMAIL PROTECTED]> > > -- > Tuna Toksöz > > Typos included to enhance the readers attention! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
