title: Order by clause not working in hibernate
body: <p>My hql query is shown below but it is not ordering the records by a.remoteCreatedAt column, please help me if there is any mistake in order by clause.</p>
  
  <pre><code>SELECT c
  FROM Comic c
  JOIN FETCH c.album a
  JOIN FETCH a.media m
  JOIN FETCH c.user u
  LEFT JOIN FETCH a.user ow
  LEFT JOIN FETCH c.channel channel
  LEFT JOIN FETCH c.categories cc
  WHERE a.publishedAt !=NULL
    AND channel.uniqueName IN (:channelUniqueNames)
    AND channel.active = TRUE
    AND c.active=TRUE
    AND c.visibilityType='PUBLIC'
  ORDER BY CASE
               WHEN a.remoteCreatedAt !=NULL THEN a.remoteCreatedAt
               ELSE a.publishedAt
           END DESC
  </code></pre>