Hi Steve, yes that seems very reasonable. +1 for checking the parent "scope" too, I think that would feel natural as it matches the scope rules of variables in Java.
On 7 October 2015 at 15:00, Steve Ebersole <st...@hibernate.org> wrote: > At the moment the alias registry is global for the whole query. I propose > that we should scope this by "query spec" (combined with parent). The > reason being that reusing the same alias in unrelated subqueries is > perfectly fine. > > select ... > from Customer c > where c.id in ( > select o.customer.id > from Order o > ... > ) > or c.id in ( > select c1.id > from Outstanding o > ... > ) > > Here the aliases `o` don't ever infringe on each other. So imo we should > allow that. > > The piece about checking the parent is for a case like: > select ... > from Customer c > where c.id in ( > select c.id > from Order o > join o.customer c > ... > ) > > Here the aliases `c` do infringe. In the subquery, we don't really know > which reference the `c` alias should resolve to. We *could* here assuming > that the subquery is uncorrelated. Bu without this rule we really would > not know that the subquery is correlated. Hopefully that makes sense, what > I am getting at. > > WDYT? > _______________________________________________ > hibernate-dev mailing list > hibernate-dev@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/hibernate-dev _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev