zoukankan      html  css  js  c++  java
  • mysql date数据类型异常原因0000-00

    1.数据库字段:

    `dri_lic_first_time` date DEFAULT NULL COMMENT '驾驶证初次领证日期',

    2.异常信息

    org.springframework.dao.TransientDataAccessResourceException: 
    ### Error querying database.  Cause: java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp
    ### The error may exist in com/autoyol/mapper/MemberMapper.xml
    ### The error may involve com.autoyol.mapper.MemberMapper.getMemBaseInfoByToken
    ### The error occurred while handling results
    ### SQL: SELECT reg_no as memNo, nick_name AS nickName, real_name AS realName, first_name AS firstName, gender, mobile,     base_dir AS userBasePath, portrait_path AS portrait, res_times AS ownerResTimes, res_total_time AS ownerResTotalTime,     res_avg_time AS ownerResAvgTime, buy_times AS rentTimes, buy_total_res_time AS renterResTotalTime,     buy_res_avg_time AS renterResAvgTime, email, email_auth AS emailAuth, id_card_auth,     id_card_back_auth, dri_lic_auth, day_req_count, day_cancel_req_count, rent_flag, renter_rating as renterRating ,dri_lic_first_time as driLicFirstTime    FROM member WHERE token=?
    ### Cause: java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp
    ; SQL []; Value '0000-00-00' can not be represented as java.sql.Timestamp; nested exception is java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp

    3.分析

    3.1在客户端修改数据为空,系统会默认加上'0000-00',这样在查询的时候,映射会报错,无法理解这个日期时间

    3.2如果要去掉日期数据,需要填写NULL,这样才可以。

    3.2直接选择日期或填写日期,2015-01-22

  • 相关阅读:
    ASP.NET 2.0 解决了 CodeBehind 需要控件声明同步的问题
    Script# 把 C# 编译为 JavaScript
    我不懂 ASP.NET
    ASP.NET 是如何让 aspx 完全编译的呢?
    ASP.NET 设计优秀之处
    .NET 的灵魂是什么?
    初次使用Atlas JavaScript (Part 2 Web Service扩展)
    XNA Microsoft 平台的新游戏框架
    ViewState ASP.NET 的一个特有存储容器
    2 Ways Thinking In Ajax
  • 原文地址:https://www.cnblogs.com/simpledev/p/4241718.html
Copyright © 2011-2022 走看看