hibernate:Not all named parameters have been

2021-03-20 22:25

阅读:386

标签:dateutils   数据类型   turn   effect   where   for   bsp   cte   ring   

出错信息

update Project p set p.returnCount=:returnCount,p.passTime =:passTime, p.returnTime=:returnTime where p.id=:id

Not all named parameters have been set: [passTime]

passTime是Date数据类型,现在需要设置成null,只需要把hql里面改对象设置为null

    public void updateReturnCount(Project project){
        try {
            String hql = "update Project p set p.returnCount=:returnCount,p.passTime=null, p.returnTime=:returnTime where p.id=:id";
            Parameter param = new Parameter();
            param.put("returnCount",project.getReturnCount());
            // 如果需要前台设置驳回时间,替换成project.getReturnTime()
            param.put("returnTime",DateUtils.getSysDate());
            param.put("id",project.getId());
            int effected = projectDao.batchExecute(hql, param);
            log.info("projectId:{},更新后returnCount:{},驳回时间:{},更新{}条数",
                    project.getId(),project.getReturnCount(), DateUtils.dateFormat(project.getReturnTime()),effected);
        }catch (Exception e) {
            log.error("项目驳回出错:{}",e);
        }
    }

 

hibernate:Not all named parameters have been

标签:dateutils   数据类型   turn   effect   where   for   bsp   cte   ring   

原文地址:https://www.cnblogs.com/passedbylove/p/12731183.html


评论


亲,登录后才可以留言!