加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – 如何在HQL中使用顺序?

发布时间:2020-12-14 06:05:41 所属栏目:Java 来源:网络整理
导读:我想像这样执行我的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) .setPa
我想像这样执行我的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 by子句.

解决方法

看来你必须将“order by”放在HSQL查询中,但是有一个空格:
"from Payment where vcode=:p_Vcode or (Installment_Vcode=:installmentVcode and
payment_date>:pdate) order by vcode desc"

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读