Thanks, will give it a go,  I guess for associations on the link (I
have two one-to-ones) I need to group by those properties also.

On Feb 5, 5:40 pm, Diego Mijelshon <[email protected]> wrote:
> Just like with SQL, you need to specify all of the properties in the group
> by clause.
> Yes, it would be nice for NH to do it. Yes, it's a leaky abstraction. But
> that's how it is...
> "group by entity" is translated as "group by entity.id".
>
> This query should work:
>
> select item, count(children)
> from ItemLink item
> left join item.Children children
> group by item.Id, {all other properties in ItemLink}
>
>    Diego
>
> On Thu, Feb 4, 2010 at 12:52, Kevin Fairclough <
>
> [email protected]> wrote:
> > Hi
>
> > This should be easy to do, but I cannot figure it out.
> > I have a recursive object ItemLink object which contains a list of
> > itself ChildLinks
>
> > I want to get the next level of links with a count of links at the
> > following level, i.e. the child count.
>
> > Session.CreateQuery("select i, count(children) from ItemLink i left
> > outer join i.ChildLinks children group by i.id").List()
>
> > The above query doesn't work, but this query does:
> > Session.CreateQuery("select i.id, count(children) from ItemLink i left
> > outer join i.ChildLinks children group by i.id").List()
>
> > how can I fetch the whole ItemLink object and also the Count in one
> > query?
>
> > TIA
> > Kevin
>
> > --
> > 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]<nhusers%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.
>
>

-- 
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