- 问题复现
设置mysql timestamp 时间类型支持0000-00-00 00:00:00数据
set sql_mode=(select replace(@@sql_mode,'NO_ZERO_IN_DATE,NO_ZERO_DATE',''));
报错
org.springframework.dao.TransientDataAccessResourceException: Error attempting to get column 'birthday' from result set. Cause: java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
; 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
数据库连接jdbc url添加, 设置 该中数据自动转换成null, 即可解决
&zeroDateTimeBehavior=convertToNull