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 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献