title: Hibernate HQL is failing on alias ordering
body: <p>I have this query in hql:</p>
  
  <pre><code>select sum(settledPricePerDownloadExpense),avg(settledPricePerDownloadExpense),sum(siteIdCount) as ct,sum(settledPricePerDownloadExpense) 
  from PpdCampaignReporting  where id.ppdCampaignReportDate between 'Wed May 11 00:00:00 EDT 2011' and 'Thu May 12 23:59:59 EDT 2011' And id.ppdCampaignActionTypeId in (1, 2, 3) And id.ppdCampaign.ppdCampaignId in (62,63,82,83,84,95,97) 
  group by id.ppdCampaignActionTypeId,id.siteId order by ct
  </code></pre>
  
  <p>The error I am getting back is this:  </p>
  
  <pre><code>Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid column name 'ct'.
  </code></pre>
  
  <p>Which I don't understand since I have sum(siteIdCount) as ct</p>