java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp

时间:2024-11-15 18:04:25

java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp 错误是因为时间类型出现了0000-00-00 00:00:00 而在hibernate将结果映射成实体时,会认为此种格式不是正确的java.sql.Timestamp,固会报错

解决方式是在url后添加&zeroDateTimeBehavior=convertToNull

java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp