List<TContentType> listall=new ArrayList<TContentType>();
listall=service.query("select distinct typeName,typeId from TContentType");我该怎么获取到listall里面的typeName 属性的值,不会写了,求指点

解决方案 »

  1.   

    这个是要循环list取值的
    网上也有更好的,可以自己去找找
    public static List<ReportParamter> getBrandData(List list,String startsName) throws Exception {
    List<ReportParamter> reportParamters =  new ArrayList<ReportParamter>();
    if(!StringUtil.isEmpty(startsName)){
    for(Object obj : list){
    if(obj instanceof ReportParamter){
    ReportParamter rp = (ReportParamter)obj;
    if(!StringUtil.isEmpty(rp.getParamId()) && rp.getParamId().indexOf(startsName)!=-1){
    reportParamters.add(rp);
    }
    }
    }
    }
    return reportParamters;
    }
      

  2.   

    循环listall可以得到TContentType对象,tContentType.getTypeName(),就取得了!
      

  3.   

    你是要去重还是取数据。上面都说了。query 你返回的是list 吗? sql 还是hql 
      

  4.   


    oracle的
    怎么样抽取重复记录 
    select * from table t1 where where t1.rowed != 
    (select max(rowed) from table t2 
    where t1.id=t2.id and t1.name=t2.name) 
    或者 
    select count(*), t.col_a,t.col_b from table t 
    group by col_a,col_b 
    having count(*)>1