I've got an HQL statement like this:
select new map (f1 as field1, (select ...) as field2)
from ...
where ...
order by field2;
It fails saying "Unknown column 'field2'". I experienced this in general that when using the "new map" statement, I can't reference the map names in the order by field.
As HQL subqueries are only allowed in the select or the where clause, I can't just copy over the subquery to the order by clause either (which wouldn't be so nice anyway).
Am I missing something or do I have to refrain from using a map?