Is there any way to set order by clause in HQL by run time. i.e. select obj from Example1 order by <Here my column name and asc or desc these two thing want to set in run time>.
Any proper solution…? I have try with adding two ? but it’s not working. By replacing with string it could work….But is there any other way from HQL….
The only way is to concatenate the appropriate field. If you don’t like it, use the Criteria API, which is designed to generate queries dynamically.