2 Replies Latest reply on Oct 14, 2009 12:19 PM by narinkalra

    Order by clause in hibernate

      Hi,


      I got problem in hibernate query, when i tries to set order by clause on the entity column.


      For eg. if in user table i have a foreign key on department. Then for fetching the information from user, i have written the hibernate query as


      Select user From User user order by department.


      Now in this case hibernate is not able to parse the query. In other case if i use alias in front of order by column like : Select user From User user order by user.department. It works fine. Is it some problem in hibernate or am i missing something.