首页 > sql查询实体。。

sql查询实体。。

public Map<String, Object> delete(JSONObject head, JSONObject body)
            throws Exception {
        Map<String, Object> attributes=new HashMap<String, Object>();
        JSONArray couponJson=body.optJSONArray("couponId");
         
            String token=head.optString("token");
        Object object=UserCacheManage.getAppUser(token);
        
        //if(object!=null){
        //UserCache user=(UserCache)object;
        String userId="4028668150c6aedb0150c6ddde750005";
        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 query ="SELECT c FROM couponpublish c,couponpool s WHERE s.owner='"+userId+"' and c.pubid=s.pubid";
            List<CouponPublishEntity> list = super.findListbySqlReturnMap(query);
            if(list!=null&&list.size()>0){
                super.deleteAllEntitie(list);
            }
想查询couponpublish表的实体然后删除掉,但是报错Unknown column 'c' in 'field list'
select c这样写不行。。应该咋写= =            
                

c不是字段,是表别名,你应该select c.xx from ...

String query ="SELECT c FROM couponpublish c,couponpool s WHERE s.owner='"+userId+"' and c.pubid=s.pubid";
【热门文章】
【热门文章】