Java – how to use order in HQL?
•
Java
I want to execute my HQL query like this:
Query queryPayment=sixSession.createQuery("from Payment where vcode=:p_Vcode or (Installment_Vcode=:installmentVcode and payment_date>:pdate) order byvcode."+order +"desc") .setParameter("p_Vcode",p_Vcode) .setParameter("installmentVcode",installmentVcode) .setParameter("pdate",pdate);
But it doesn't recognize orders. I need the order by clause
Solution
It seems that you must put "order by" in the hsql query, but there is a space:
"from Payment where vcode=:p_Vcode or (Installment_Vcode=:installmentVcode and payment_date>:pdate) order by vcode desc"
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码