23

我想像这样执行我的 HQL 查询:

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);

但它不承认+order+
我需要 order by 子句。

4

1 回答 1

34

看来您必须在 HSQL 查询中添加“order by”,但要使用空格:

"from Payment where vcode=:p_Vcode or (Installment_Vcode=:installmentVcode and
payment_date>:pdate) order by vcode desc"
于 2012-05-29T07:50:54.297 回答