i am using java with hibernate . i want to run a hibernate order by query thru java.
i have written the query in hibernate.hbm.xml file. the query is as follows:

SELECT distinct a.process_id, a.name name, a.category_id,c.parent_id
FROM tbl_process_master a, tbl_category c where (lower(a.name) like :searchString or lower(a.description) like :searchString or
lower(a.meta_tag) like :searchString ) and a.status=:status and a.category_id=c.cat_id
order by :orderBy
(the colon before orderBy is not visible because of the smiley it is actually orderBy: orderBy)

(orderBy is passed from java method as a parameter)
public List getSearchResult(String searchString, status,String orderBy {

the java method calling this query contains follows only the calling of query is written below rest has been omitted as it is not reqd.:

Session ss=s.openSession();
List ProcessList1 = ss.getNamedQuery("getSearchResultForProcess1")
.setString("searchString", searchString)
.setString("status", status)
.setString("orderBy", orderBy)

then i iterate the List.

the problem is the query works fine if i write the script directly from sql command window or i write the query as

above query order by ' " + orderBy+" '

and orderby also works based on the parameter given to it.
but when i try to run the same query thru hibernate ie writing the query in hibernate.hbm.xml file and passing the orderby parameter thru a java method aas described above the query runs but orderby does not happen

The problem is that hibernate converts the orderby parameter as 'orderBy' and then tries to do order by with those quotes.as there is no col name or col no. with the 'orderBy' the orderby clause does not get fired.

please suggest some solution other than the one i have provided my self