Hi Dani,

I am a bit confused by your question because you mention you have a parent
class and a derived class, but then in your mapping you do this on the
derived class:

References(a => a.ParentClass, tblDerived.ParentSeqID);

Which creates a many-to-one mapping. So which is it? Is this an association
relationship or an inheritance relationship?

On Tue, Dec 8, 2009 at 9:22 PM, Dani <[email protected]> wrote:

> I've tried the NH user group, no luck so far, here is a problem:
>
> I'm using FNH,
>
> I'm trying to run HQL query to get a list of objects.
> The problem is that I have an Class and Derived Class, and I only want
> to get the parent class's objects:
>
> IN NHibernate Reference there is this example:
>
> from Eg.Cat cat where cat.class = Eg.DomesticCat
>
> I'm trying to use this (from myParent where myParent.father.id = 3 and
> myParent.class = ParentClass)
> or
> from myParent where myParent.father.id = 3 and myParent.class
> = :ParentClass)
> with .AddParameter(0,typeof(ParentClass)
>
> Nothing works,
>
> NH doesn't know the myParent.class
>
> (the .class is the problem).
>
> how can I achieve this ?
>
> Both parent and derived class are mapped, the connection in the
> mapping is like this (although not relevant to the usage of the .class
> inside the HQL):
>
> The Parent class has:
>
> HasMany(x => x.DerivedClass).KeyColumns.Add
> (tblDerived.ParentSeqID).AsBag().Inverse().Cascade.All();
>
> and the derived class has :
>
> References(a => a.ParentClass, tblDerived.ParentSeqID);
>
> Dani
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Fluent NHibernate" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<fluent-nhibernate%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/fluent-nhibernate?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" 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/fluent-nhibernate?hl=en.


Reply via email to