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
    关注

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

    评论

报告相同问题?

悬赏问题

  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥15 Stata 面板数据模型选择
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏