gpt4 book ai didi

java - 如何在 HQL 中使用 order by?

转载 作者:IT老高 更新时间:2023-10-28 20:59:34 25 4
gpt4 key购买 nike

我想像这样执行我的 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 子句。

最佳答案

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

"from Payment where vcode=:p_Vcode or (Installment_Vcode=:installmentVcode and
payment_date>:pdate) order by vcode desc"

关于java - 如何在 HQL 中使用 order by?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10795013/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com