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 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)