tags:

views:

34

answers:

1

I written a query in my sql like this:

"select * from table_name order by col_name = 101 desc "

Which is working perfectly fine in mysql but when I tried to convert this query into HQl query then it is throwing an exception.So can anyone suggest me that how to write HQL query for the above SQL query.

+2  A: 

i doubt that's working fine in mysql... did you mean something like

select * from table_name where col2_name = 101 order by col1_name desc

in hibernate you pretty much just need to replace table_name and col_name with the actual class and property names, eg (you can leave off the select if you're just querying a whole entity)

FROM EntityName where property1Name = 101 order by property2Name desc

oedo