?????????л???????????????????????????????????????????????????????????????£????????????????????????????????????????Щ????????????????????

?????б?????£?

T_SOME_TABLE{
crowid varchar(36);
zrmb float(7??3);
zjdw float(7??3);
}
 


?????????????δ?????λ????????????

??????????????

//??????????£?
    String hqlStr="select SUM(t.zrmb) AS SUM_1??SUM(t.zjdw) AS SUM_2 from T_SOME_TABLE t where 1=1 ";
    List sumList=baseDao.find(hqlStr);//hibernate?????HQL???????????List
    request.setAttribute("sumList"??sumList);

//?????????£?
    String sum1="";
    String sum2="";
    ArrayList sumList=request.getAttribute("sumList")==null?null:(ArrayList)request.getAttribute("sumList");
    if(null!=sumList){
        for(int i=0;i<sumList.size();i++){
            Object[] tempObj=(Object[])sumList.get(i);
            sum1=tempObj[0]==null?"0.0":tempObj[0].toString();
            sum2=tempObj[1]==null?"0.0":tempObj[1].toString();
        }
    }
    out.prinln("sum1:"+sum1);
    out.prinln("sum2:"+sum2);
 


??????????ζ???

//??????????£?
    String hqlStr="select SUM(t.zrmb) AS SUM_1  from T_SOME_TABLE t where 1=1 ";
    List sumList=baseDao.find(hqlStr);//hibernate?????HQL???????????List
    request.setAttribute("sumList"??sumList);

//?????????£?
    String sum1="";
    ArrayList sumList=request.getAttribute("sumList")==null?null:(ArrayList)request.getAttribute("sumList");
    if(null!=sumList){
        for(int i=0;i<sumList.size();i++){
            Object[] tempObj=(Object[])sumList.get(i);
            sum1=tempObj[0]==null?"0.0":tempObj[0].toString();
        }
    }
    out.prinln("sum1:"+sum1);
 


??????????л??? ???????2???????? ?????????1?????????????е?????????????????????? ???2???????1???????????????????????????????? ???????????????????????????????????????????????????????????????????????????£?

????????hibernate???????? ??hibernate????sql??????????????????????????Object????浽List?е????????1?????2???????????????ε????????????2?????????? ?????????Object[]???????????????飬??????????????ε??List???????Object????????Object[]???顣

????????????????????hibernate??????????????

????????2???????????

Object tempObj=(Object)sumList.get(i); 
sum1=tempObj==null?"0.0":tempObj.toString();