日期:2014-05-17  浏览次数:20708 次

[Ljava.lang.Object; cannot be cast to 。。。错误,为啥能取值不能get?
_list取到值了,但是取出来一直有问题,一get就跳转异常,快疯了,是三张表的联合查询


Java code

//service
public List<Evaluatescholarship> find(String year,String major,Timestamp startTime,Timestamp endTime)throws BusinessException{
        StringBuffer queryStringBuffer = new StringBuffer("from Evaluatescholarship e,Stubasicinfo s,Majorinfo m where e.stubasicinfo = s.stbStuNo and s.majorinfo = m.mno");
        
        System.out.println("servicebefore");
        String[] params = new String[] {year, major}; 
        if(!"".equals(year)){
            queryStringBuffer.append(" and s.syear = ? ");
//            queryStringBuffer.append(" syear="+"'"+year+"'");
            if (!"".equals(major)) {
                //queryStringBuffer.append(" and e.stubasicinfo.majorinfo.mname = ? ");
                queryStringBuffer.append(" and m.mname = ? ");
//                queryStringBuffer.append(" and majorinfo.mname="+"'"+major+"'");
//                        +" and estartTime between "+"'"+startTime+"'"+" and "+"'"+endTime+"'"+" and eendTime between "+"'"+startTime+"'"+" and "+"'"+endTime+"'"+" ");        
            }
            else {
//                queryStringBuffer.append(" and estartTime between "+"'"+startTime+"'"+" and "+"'"+endTime+"'"+" and eendTime between "+"'"+startTime+"'"+" and "+"'"+endTime+"'"+" ");
            }            
        }
        else {
//            queryStringBuffer.append(" estartTime between "+"'"+startTime+"'"+" and "+"'"+endTime+"'"+" and eendTime between "+"'"+startTime+"'"+" and "+"'"+endTime+"'"+" ");
        }
        System.out.println(queryStringBuffer);
        List<Evaluatescholarship> _list =  this.evaluateScholarshipDao.find(queryStringBuffer.toString(), params);
        if(null == _list) {
            throw new BusinessException("无法取到值");
        } 
        return _list;
    }



Java code

//dao
public List<Evaluatescholarship> find(String queryString, String[] params){
        System.out.println("daobefore");
        List list = this.dataAccessUtil.find(queryString,params);
        System.out.println(list.isEmpty());
        return (List<Evaluatescholarship>)list;
    }



Java code

//action
public String findList() throws Exception{
        String currentTime = TimeGenerator.getCurrentTime();
        try {
            /*System.out.println("actionbefore"+evaluatescholarship.getStubasicinfo().getSyear().toString());            
            System.out.println(evaluatescholarship.getStubasicinfo().getMajorinfo().getMname().toString());*/
            List<Evaluatescholarship> _list = this.evaluateScholarshipService.find(evaluatescholarship.getStubasicinfo().getSyear(),evaluatescholarship.getStubasicinfo().getMajorinfo().getMname(),startTime,endTime);
            System.out.println("evaluateScholarAction size="+_list.size());
            if (null == _list) {
                return "input";
            } else {