java - hql查询问题。。。。。
阿神
阿神 2017-04-17 17:26:05
0
1
234

后台代码:

HhUserEntity hhUserEntity=super.getEntity(HhUserEntity.class, userId);
        if(hhUserEntity!=null){
            String ids="";
            Object [] couponIds=(Object[])couponJson.toArray();
            if(couponIds!=null&&couponIds.length>0){
                for(int i=0;i<couponIds.length;i++){
                    if(i==0){
                        ids=ids+"'"+couponIds[i]+"'";
                    }else{
                        ids=ids+",'"+couponIds[i]+"'";
                    }
                }    
            }
            
            String hql="from CouponPublishEntity e left join CouponPoolEntity d where d.pubId=e.pubId and  d.owner='"+userId+"' and e.pubid in ("+ids+") ";
            List<HhCouponsEntity> list = super.findByQueryString(hql);
            System.out.println(list);
            if(list!=null&&list.size()>0){
                super.deleteAllEntitie(list);
            }
            

报错:
[org.jeecgframework.core.common.exception.GlobalExceptionResolver]全局处理异常捕获:
org.hibernate.QueryException: could not resolve property: pubid of: com.sendiy.hh.coupons.entity.CouponPublishEntity [from com.sendiy.hh.coupons.entity.CouponPublishEntity e left join Coupon 。。。

"obj": {

    "code": "201",
    "msg": "could not resolve property: pubid of: com.sendiy.hh.coupons.entity.CouponPublishEntity [from com.sendiy.hh.coupons.entity.CouponPublishEntity e left join CouponPoolEntity d where d.pubId=e.pubId and  d.owner='4028668150c6aedb0150c6ddde750005' and e.pubid in ('2') ]"
},
"attributes": {},
"msg": "操作成功",
"success": true

阿神
阿神

闭关修行中......

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!