title: how to use order by clause for case insensitive listing in hibernate named query
body: <p>I have a user table</p>
  
  <p><strong>Users</strong></p>
  
  <pre><code>userId firstName
  1      A
  2      B
  3      a
  </code></pre>
  
  <p>My SQL query (<code>select * from User order by firstName</code>) returns correct result:</p>
  
  <pre><code>A
  a
  B
  </code></pre>
  
  <p>HQL named query (<code>Select up from UserProfile up, User u where up.userId  = u.userId order by upper(u.firstName)</code>) gives:
      A
      B
      a</p>
  
  <p>Can somebody explain me this behavior and a workaround to get case insensitive sorting working (note: <em>using upper function does not help</em>).
  I noticed <code>Criteria has ignoreCase</code> function but I do not want to use criteria but HQL query</p>