Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp; nested exception is java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
好久没记录了,最近一直在忙着工作以及码前后端 记录下这种大多数人都会碰到但是又不一定找得到问题的错误
1 Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp; nested exception is java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp

一般是数据库表设计字段为DateTime类型时数据库默认给了0000-00-00这种默认值,在数据库看来是合法合理的,但是在jvm中并不认可
因此,做法无非就是让他输出的默认值变为 null 或者 有正确的默认值输出
解决方法也很简单:在数据库链接后加上 &zeroDateTimeBehavior=convertToNull 这样输出默认值为null 就不会报错了

Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp; nested exception is java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp的更多相关文章
- Mybatis笔记四:nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'id' in 'class java.lang.String'
错误异常:nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for pr ...
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'socialCode' in 'class java.lang.String'
异常: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.Refl ...
- nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'enterpriseId' in 'class java.lang.String'
错误信息: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for p ...
- JSON parse error: default constructor not found. class java.time.YearMonth; nested exception is com.alibaba.fastjson.JSONException: default constructor not found. class java.time.YearMonth
java8新出的YearMonth可以方便的用来表示某个月.我的项目中使用springmvc来接收YearMonth类型的数据时发现 x-www-from-urlencoded 格式的数据可以使用&q ...
- bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL ...
- SqlMapClient operation; bad SQL grammar []; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: InlineParameterMap
<select id="getResByName" resultClass="Resources" parameterClass="java.l ...
- nested exception is java.sql.SQLException: Cannot convert value '0000-00-00 00:00:00' from column 14 to TIMESTAMP.
无法将"0000-00-00 00:00:00"转换为TIMESTAMP 2017-05-08 00:56:59 [ERROR] - cn.kee.core.dao.impl.Ge ...
- Failed to convert from type [java.lang.String] to type [java.util.Date] for value '2020-02-06'; nested exception is java.lang.IllegalArgumentException]解决
今天做springbook项目前端输入日期传到数据库保存报了一下错误 Whitelabel Error Page This application has no explicit mapping fo ...
- Spring 整合 Flex (BlazeDS)无法从as对象 到 Java对象转换的异常:org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.Date' to required type 'java.sql.Timestamp' for property 'wfsj'; nested exception is java.lang.Ill
异常信息如下: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value ...
- 启动Spring boot报错:nested exception is java.sql.SQLException: Field 'id' doesn't have a default value
先看具体日志: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with n ...
随机推荐
- 【经验分享】RTC 技术系列之视频编解码
要了解什么是视频编解码,首先我们需要了解什么是视频. 视频归根结底是一系列连续的图像帧,当这些图像以一定速率播放时,人眼就会判断其是连续活动的,这样就构成了视频. 那为什么要进行视频编解码呢,因为视频 ...
- Spring Bean 的生命周期(详细解读)
Spring Bean 的生命周期简单易懂.在一个 bean 实例被初始化时,需要执行一系列的初始化操作以达到可用的状态.同样的,当一个 bean 不再被调用时需要进行相关的析构操作,并从 bean ...
- GUI编程 --2
GUI编程 --2 2.4 事件监听 按钮的使用. package com.ssl.lesson02; import java.awt.*; import java.awt.event.ActionE ...
- Windows系统下Dos命令记录
# 切换到F:\test\目录 /d 参数可以直接切换,不需要先切换盘符 cd /d F:\test\ # 创建文件夹test md tset # 删除文件夹test rd test # 创建文件te ...
- hta--Windows运行html的桌面应用程序(HTML应用程序)
HTA(HTML Application)-- HTML应用程序 作为前端开发,我们能熟练使用html实现各种效果,但是如果要实现一个简单的桌面应用程序那么应该怎么做呢,答案很简单,只需要把html文 ...
- R语言网络数据爬取
现在大家对爬虫的兴趣不断高涨,R和PYTHON是两个非常有力的爬虫工具.Python倾向于做大型爬虫,与R相比,语法相对复杂,因此Python爬虫的学习曲线会相对陡峭.对于那些时间宝贵,又想从网上获取 ...
- 二进制安装Kubernetes(k8s)IPv4/IPv6双栈 v1.24.0
二进制安装Kubernetes(k8s) v1.24.0 IPv4/IPv6双栈 介绍 kubernetes二进制安装 1.23.3 和 1.23.4 和 1.23.5 和 1.23.6 和 1.24 ...
- linux 给lvm磁盘扩容
目录 linux 给lvm磁盘扩容 扩容步骤 确认可用空间 创建新的物理卷 将物理卷添加到现有的卷组中 扩展逻辑卷 linux 给lvm磁盘扩容 早上到公司发现磁盘满了,挂载点是一个lvm 跟领导确认 ...
- go-easy-utils 2.0 正式发布,全面支持泛型和any
介绍 这是一个基于 Go 语言开发的通用数据类型处理工具类,帮助开发者在业务代码实现中处理常见的数据类型和数据操作.可以让您专注于您的业务代码的实现,而免去处理基本数据类型转换和验证的功能.该工具库无 ...
- 【Vue】二
一个第三方js处理类库 BootCDN Vue过滤器 Date.now() 获取时间戳 Date.now() 1652411231222 计算属性实现 <body> <div id= ...