码迷,mamicode.com
首页 > 数据库 > 详细

mysql date数据类型异常原因0000-00

时间:2015-01-22 17:07:48      阅读:1300      评论:0      收藏:0      [点我收藏+]

标签:

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

 

mysql date数据类型异常原因0000-00

标签:

原文地址:http://www.cnblogs.com/simpledev/p/4241718.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!