The query mentioned below does not work without an "as" but does with an "as". 

Is this likely a bug? I am relatively new to NHibernate and the .net OSS world 
in general, where can I find instructions for submitting a test displaying the 
behavior? Is it likely that there is another problem with the query which is 
causing this behavior and the "as" solves?  By that I mean that should this 
query be altered in a different way and would thus not require the "as"?

Would you be so kind to elaborate a bit  on your statement and explain the 
realm of possibilities to the uninitiated?
-----Original Message-----
From: Fabio Maulo <[email protected]>
Date: Mon, 14 Dec 2009 09:33:34 
To: <[email protected]>
Subject: Re: [nhusers] Re: Populating child collections in HQL - Summer of 
        Nhibernate 06 - Elements

"as" in the alias of a "from" clause should never be required.

2009/12/14 Yonah Wahrhaftig <[email protected]>

> I would love to hear an explanation from anyone else on the list on this.
>
> When is an explicit "as" required?  I recall that at the time I stepped
> through the Antlr parser and saw that it was choking on not recognizing the
> "o" as an alias, but don't believe I ever understood why?
> -----Original Message-----
> From: RobB <[email protected]>
> Date: Mon, 14 Dec 2009 00:17:27
> To: nhusers<[email protected]>
> Subject: [nhusers] Re: Populating child collections in HQL - Summer of
>        Nhibernate 06 - Elements
>
> Yep - "as o" rather than simply "o" did the trick.   Can't believe I
> didn't try it but thanks very much for that, it hopefully won't get me
> next time.
>
> Rob
>
>
> On 9 Dec, 11:54, "Yonah Wahrhaftig" <[email protected]> wrote:
> > I solved this problem by specifying as o.
> > "select distinct c from Customer c , c.Orders.elements as o where
> > o.OrderDate > :orderDate"
> >
> > ------Original Message------
> > From: RobB
> > Sender: [email protected]
> > To: nhusers
> > ReplyTo: [email protected]
> > Subject: [nhusers] Populating child collections in HQL  - Summer of
> Nhibernate 06 - Elements
> > Sent: Dec 7, 2009 10:18 AM
> >
> > Hi,
> >
> > I've been working through the screen casts Steve B. put together
> > building up to using Nhibernate on my next project.  I'm up to Session
> > 6, Advanced Querying of Child Collections and have hit a problem when
> > trying to get Steve's HQL example to work.   I know Steve frequents
> > this group and there is a blog for SOH but thought I'd ask in here as
> > I've just registered for the group and thought my idiotic question
> > would act as a good introduction.
> >
> > Anyway the idea was to retrieve a customer and a collection of their
> > orders, where the orders were placed after a given date.   The HQL
> > was :
> >
> > "select distinct c from Customer c , c.Orders.elements o where
> > o.OrderDate > :orderDate"
> >
> > I was getting an error of "c.Orders.elements is not mapped".  I had a
> > dig around and it seemed that the syntax for getting a collection of
> > elements had changed, the correct syntax would be "elements
> > (c.Orders)".
> >
> > I tried using this but then got an
> > "Antlr.Runtime.MissingTokenException".   I couldn't find any further
> > examples without an explicit join on the child objects and so have
> > ended up using the following :
> >
> > "Select distinct c from Customer c inner join fetch c.Orders o where
> > o.OrderDate > :orderDate"
> >
> > I'd much rather use a construct along the lines of the first HQL
> > statement with an implicit join and I know I probably can't see the
> > wood for the trees.  Can anyone give me any pointers on this one?
> >
> > Many thanks
> >
> > Rob
> >
> > --
> >
> > 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 athttp://
> groups.google.com/group/nhusers?hl=en.
> >
> > Sent via BlackBerry
>
> --
>
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>
>


-- 
Fabio Maulo

--

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.



--

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