最近写项目使用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);
还请大家帮忙看看!