dream_maker2333 2016-05-08 07:02 采纳率: 0%
浏览 2164

向mysql数据库时间类型数据插入失败

以前存入的时间数据是 new Date();
dvciCheckInfoModel.setApplyTime(new Date());
dvciCheckInfoModel.setCreateDate(new Date());
生日的格式是图片说明
现在我从数据库获取到这些时间后又需要重新update进去时却报错了
Field error in object 'dvciCheckInfoModel' on field 'applyTime': rejected value [2016-05-04 17:16:07.0]; codes [typeMismatch.dvciCheckInfoModel.applyTime,typeMismatch.applyTime,typeMismatch.java.util.Date,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [dvciCheckInfoModel.applyTime,applyTime]; arguments []; default message [applyTime]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date' for property 'applyTime'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type java.lang.String to type java.util.Date for value '2016-05-04 17:16:07.0'; nested exception is java.lang.IllegalArgumentException]
Field error in object 'dvciCheckInfoModel' on field 'birthday': rejected value [2016-05-11]; codes [typeMismatch.dvciCheckInfoModel.birthday,typeMismatch.birthday,typeMismatch.java.util.Date,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [dvciCheckInfoModel.birthday,birthday]; arguments []; default message [birthday]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date' for property 'birthday'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type java.lang.String to type java.util.Date for value '2016-05-11'; nested exception is java.lang.IllegalArgumentException]
Field error in object 'dvciCheckInfoModel' on field 'createDate': rejected value [2016-05-04 17:16:07.0]; codes [typeMismatch.dvciCheckInfoModel.createDate,typeMismatch.createDate,typeMismatch.java.util.Date,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [dvciCheckInfoModel.createDate,createDate]; arguments []; default message [createDate]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date' for property 'createDate'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type java.lang.String to type java.util.Date for value '2016-05-04 17:16:07.0'; nested exception is java.lang.IllegalArgumentException]
数据库中生日的时间类型是Date
另外两个是Datetime

小白我弄了好长时间了,求解答啊

  • 写回答

1条回答

  • lazy cat 2016-05-08 07:32
    关注

    把代码贴出来,这样不好看用什么问题

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog