• hibernate:Not all named parameters have been


    出错信息

    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);
            }
        }
  • 相关阅读:
    Docker
    Web
    爬虫
    Python
    软件脱壳
    网络抓包
    HTTPS单向认证,双向认证
    新版无完整背景图片滑块验证码
    Frida Hook
    闭包函数与装饰器
  • 原文地址:https://www.cnblogs.com/passedbylove/p/12731183.html
Copyright © 2020-2023  润新知