Oops, I messed up with the editor!

Back to topic, we have

class Country
{
}

class Site
{
    public virtual Site Parent { get; set; }
    public virtual Country Country { get; set; }
}

If I try to run the following Hql query:

select Parent.Country.Name
from Site Site
join Site.Parent Parent
join Site.Country Country

the generated Sql query looks like

select country3_.[Name] as col_0_0_
from [Site] site0_
inner join [Site] site1_
on site0_.[ParentId]=site1_.[Id]
, [Country] country3_                              <-------
inner join [Country] country2_
on site0_.[CountryId]=country2_.[Id]
where site1_.[CountryId]=country3_.[Id]

Of course this Sql is not well formed, since the (intended) join
between site0_ and country2_ becomes a join between country3_ and
country_2.
This results in an error because the condition of this join references
the table site0_ (that's the one that was meant to be joined) but
site0_ is there out of lexical scope.

Basically in order to resolve the path expression Parent.Country.Name,
a theta joined is used (marked with an arrow in the example), but it
can get in the middle of existing joins.
I know there are simple rewritings of this query that could avoid the
problem but since I think this is legal Hql I suppose it should work
as it is.

Does anybody have any clue?

Thanks.

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