Hello,

Thanks for your help. Children is ISet<SomeClass>, which is mapped as
a <set>. I have experimented both with Count and with Count(), but no
luck.
I am using the latest versions of NHibernate (2.1.0) and LINQ to
NHibernate (1.0).

Here is the class:

public class SomeClass
{
  public virtual Int32 Id { get; private set; }
  public virtual SomeClass Parent { get; set; }
  public virtual ISet<SomeClass> Children { get; private set; }
}

And here is the mapping:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="NHibernateTest" auto-import="true" default-
access="property">
  <class name="SomeClass" table="`SOME_TABLE`">
    <id name="Id" column="`ID`">
      <generator class="identity"/>
    </id>
    <many-to-one name="Parent" class="SomeClass" column="`PARENT`"/>
    <set name="Children" inverse="true" cascade="all" outer-
join="true">
      <key column="`PARENT`" foreign-key="`ID`"/>
      <one-to-many class="SomeClass"/>
    </set>
  </class>
</hibernate-mapping>


On Aug 12, 6:13 pm, Tuna Toksoz <[email protected]> wrote:
> what is the type of Children? IList or IList<child>?
>
> Tuna Toksöz
> Eternal sunshine of the open source mind.
>
> http://devlicio.us/blogs/tuna_toksozhttp://tunatoksoz.comhttp://twitter.com/tehlike
>
>
>
> On Wed, Aug 12, 2009 at 12:57 PM, Ricardo Peres <[email protected]> wrote:
>
> > Hi,
>
> > I have made this answer days ago, but no one answered... Here I go
> > again. I can't run this query:
>
> > var lll = (from l in session.Linq<SomeClass>()
> >                                                   where l.Children.Count >
> > 0
> >                                                   select l).ToList();
>
> > If I use Any, it works:
>
> > var lll = (from l in session.Linq<SomeClass>()
> >                                                   where l.Children.Any() ==
> > true
> >                                                   select l).ToList();
>
> > My mappings are correct, they are quite simple and I can do all
> > operations perfectly. I basically have an Id, a Parent and a Children
> > properties, I am mapping a parent-child relationship.
>
> > The exception I get is:
>
> > QueryException: could not resolve property: Children.Id of:SomeClass
>
> > Any ideas? Where can I get more support for LINQ to NHibernate?
>
> > Thanks,
>
> > Ricardo Peres
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to