Disallow non-qualified column reference in HQL to avoid confusion with variable reference. In the following example, the query will return all users instead of users with a specific name:

entity User {
  name : String
}
function find(name : String) : [User]{
  return from User as u where u.name = name;
}

The correct version is:

 return from User as u where u.name = ~name;

Such errors can be avoided by disallowing non-qualified column references, the first query would result in a compiler error. This also simplifies the name binding analysis.

With this change, the tilde might become unnecessary as well, as the ambiguity with column reference is removed. In that case the tilde can be made optional.

Submitted by Danny Groenewegen on 24 April 2013 at 14:05

Log in to post comments