This is my NamedNativeQuery:
SELECT * FROM ( SELECT ROWNUMBER() OVER(ORDER BY CMSSCODE DESC) AS EL_ROWNM ,
CMSSCODE , CMSSDESC FROM tableName d WHERE CMSPCODE = ? ) a
WHERE a.EL_ROWNM < ? and a.EL_ROWNM > ?
I need to create in a dynamic way the order by, so my sql will be somthing like:
SELECT * FROM ( SELECT ROWNUMBER() OVER(ORDER BY ? ?) ....
so in the first parameter ?
I will use the column name i get from the user and in the second parameter ?
I will use ASC
or DESC
according to what I get from the user.
How is it possible to make a dynamic sorting in the NamedNativeQuery ?
Thank's In Advance.