开发者社区> 问答> 正文

hql查询报错。。。。实体类问题 ?报错

hql语句:
String hql="from CouponPublishEntity e inner join e.couponpool c where c.owner='"+userId+"' and e.pubid in ("+ids+") ";
报错
[org.jeecgframework.core.common.exception.GlobalExceptionResolver]全局处理异常捕获:
org.hibernate.QueryException: could not resolve property: couponpool of: com.sendiy.hh.coupons.entity.CouponPublishEntity [from com.sendiy.hh.coupons.entity.CouponPublishEntity e inner join e.couponpool c where c.owner='4028668150c6aedb0150c6ddde750005' and e.pubid in ('2') ]
问题是实体类写错了吗,还是语法错了·

展开
收起
爱吃鱼的程序员 2020-06-23 00:58:16 349 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    实体类中没有找到couponpool,看是不是你实体类中不是这样写的,hql区分大小写

    CouponPublishEntity这个实体和CouponPoolEntity这个实体不是两个实体吗,那你怎么从CouponPublishEntity中拿到CouponPoolEntity

    Stringhql="fromCouponPublishEntityeinnerjoinCouponPoolEntitycwherec.owner='"+userId+"'ande.pubidin("+ids+")";

    2020-06-23 00:58:35
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载