Can anyone point me to how we can pass an order by clause as a named parameter to HQL?
Example which works:
select tb from TransportBooking as tb
and TIMESTAMP(tb.bookingDate, tb.bookingTime) >= current_timestamp() order by tb.bookingDate
Example which does not work:
select tb from TransportBooking as tb
and TIMESTAMP(tb.bookingDate, tb.bookingTime) >= current_timestamp() order by :order
Not supported, input parameters are only allowed in the WHERE
and HAVING
clauses and you cannot use parameters for the ORDER BY
clause. Or if I rephrase, you can't use parameters for columns, only values. So, either: