i think this would work
var people = session
.CreateQuery("from Person p join p.Animals a where a.class
= :type")
.SetParameter("type", typeof(DomesticCat))
.List<Person>();
On Aug 4, 3:33 pm, Matthieu GD <[email protected]> wrote:
> Hello,
>
> I got this polymorphic association
>
> One Individual has many Animals (Animal is a class with subclasses
> like Dog and Cat, ). Now I want to retrieve individuals with animals
> of type Cat. I come across the meta-type property and this kind of
> queries :
>
> from Eg.Cat cat where cat.class = Eg.DomesticCat
> or here another
> :http://randomcode.net.nz/2008/09/19/restricting-types-returned-from-a...
>
> But when I try with my association I got this SQL error :
> Conversion failed when converting the nvarchar value
> 'FullName.DogClassNameHere' to data type int.
>
> and in Criteria I got the error that Class property is not found on
> Animal.
>
> I can do a right join on a property of Cat but I don't have any
> required property on it.
>
> Matthieu
--
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.