What happens if you try the following ?
ICriteria criteria = Session.CreateCriteria(typeof(SummerParty));
criteria.CreateCriteria("Party");
criteria.Add(Expression.Eq("class", typeof (Company));
return criteria.List<SummerParty>();
Should work, because you can access the discriminator only starting
from party and not from summerparty (in other words you first need to
walk the association to the other table)
Kind regards
On 23 jul, 10:25, Stephane EHRET <[email protected]> wrote:
> Hi Ccollie,
>
> This doesn't work: I get an error message saying can't resolve
> "Party.class".
>
> But moving on, I've noticed one thing:
>
> If I retrieve a list of Party, I can access the underlying type, e.g.
> Company.
> But if I retrieve a list of SummerParty, then the Proxy quicks in and
> hides the underlying type.
>
> Any idea how to get arround this?
>
> Thanks,
> Stef
>
> On Jul 22, 5:39 pm, ccollie <[email protected]> wrote:
>
>
>
> > // Untested...
>
> > ICriteria criteria = Session.CreateCriteria(typeof(SummerParty));
> > criteria.Add(Expression.Eq("Party.class", typeof
> > (Company));
> > return criteria.List<SummerParty>();
>
> > On Jul 22, 11:47 am, Stephane EHRET <[email protected]> wrote:
>
> > > Hi,
>
> > > In one of his post, Ayende Rahien talks
> > > aboutinheritance:http://ayende.com/Blog/archive/2009/04/10/nhibernate-mapping-ndash-in....
>
> > > Let's imagine I have an entity SummerParty with the following
> > > association:
> > > <many-to-one name="Party" class="Party" column="PartyId" not-
> > > null="false"/>
>
> > > How do I query a list of SummerParty that contains only Company
> > > parties?
> > > Is there any way to get somehow a navigation like
> > > SummerParty.CompanyParties?
>
> > > Thanks for your help,
> > > Stephane- Hide quoted text -
>
> > - Show quoted text -- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---