Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我得到一个空列表,在查询JavaSpring时出错_Java_Spring_Hibernate - Fatal编程技术网

我得到一个空列表,在查询JavaSpring时出错

我得到一个空列表,在查询JavaSpring时出错,java,spring,hibernate,Java,Spring,Hibernate,我有问题,当我进行查询时,列表是空的 @Override public List<QcReport> listQc3(double year, String hole_id) { Session session = this.sessionFactory.getCurrentSession(); List report = session.createQuery("SELECT hole_id,year FROM QcReport whe

我有问题,当我进行查询时,列表是空的

@Override 
    public List<QcReport> listQc3(double year, String hole_id) { 
        Session session = this.sessionFactory.getCurrentSession(); 
        List report = session.createQuery("SELECT hole_id,year FROM QcReport where year = " +year+" AND hole_id = :hole_id")
//              .setParameter("year", year)  
                .setParameter("hole_id", hole_id)  
                .list();  
        System.out.println(report);
        return report; 
    }

QcReport hole=new QcReport()时,构造函数中是否设置了任何默认值?您确定使用给定的参数可以从数据库中提取记录吗?使用DB客户端查询数据库时,您看到了什么?你得到结果了吗?如果我得到结果,我知道我的查询是错误的,但我不知道来源是什么
    @RequestMapping(value = "/qc_table")
    public ModelAndView listReport(@ModelAttribute("report") QcReport assay,Model model) throws IOException {
        ModelAndView mod = new ModelAndView("qc_table"); 
        QcReport hole = new QcReport();
        List<QcReport> list = qcServ.listQc3(hole.getYear(),hole.getHole_id());
        model.addAttribute("listReporte", list);
//      mod.addObject("listReporte", list);   
        return mod;  
    } 
Hibernate: 
    select
        qcreport0_.hole_id as col_0_0_,
        qcreport0_.year as col_1_0_ 
    from
        vw_dhqc_report qcreport0_ 
    where
        qcreport0_.year=0.0 
        and qcreport0_.hole_id=?
[]