码迷,mamicode.com
首页 > Web开发 > 详细

hibernate:Not all named parameters have been

时间:2020-04-19 15:09:38      阅读:90      评论:0      收藏:0      [点我收藏+]

标签: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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!