首页 新闻 搜索 专区 学院

hibernate关联查询报错:Path expected for join!

0
悬赏园豆:10 [已关闭问题] 关闭于 2016-09-27 18:39

最近写项目使用hibernate关联查询时出现Path expected for join!错误,查了很多资料也没得到解答

HQL语句如下:

StringBuffer hql = new StringBuffer("from CellPrepareAccessApply cpaa "
                + " LEFT JOIN "
                + " CellPrepareProject cpp ON cpaa.cellPrepareProject=cpp.id "
                + " LEFT JOIN "
                + " CellPrepareAccessSample cpas on cpaa.id=cpas.applyId "
                + " LEFT JOIN "
                + " CellPrepareSample cps on cpas.simpleId = cps.id where 1=1 ");
        Map<String, Object> params = new HashMap<>();
         if(StringUtils.hasText(accessVo.getProject())){
             hql.append(" and cpp.id=:id");
             params.put("id", accessVo.getProject());
         }
         if(StringUtils.hasText(accessVo.getName())){
             hql.append(" and cpaa.name = :name");
             params.put("name", accessVo.getName());
         }
         if(accessVo.getApplyStartDate()!=null){
             hql.append(" and cpaa.apply_date>=:startDate");
             params.put("startDate", accessVo.getApplyStartDate());
         }
         if(accessVo.getApplyEndDate()!=null){
             hql.append(" and cpaa.apply_date<=:endDate");
             params.put("endDate", accessVo.getApplyEndDate());
         }
        
        return query_hql(hql.toString(), params, pageNo, pageSize);

还请大家帮忙看看!

xfma的主页 xfma | 初学一级 | 园豆:194
提问于:2016-09-27 18:29
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册