MySQL 表存在两个字段类型是TIMESTAMP 的时候,经常出现问题如下:
Caused by: java.sql.SQLException: Value ‘0000-00-00 00:00:00‘ can not be represented as java.sql.Timestamp
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920)
at com.mysql.jdbc.ResultSetRow.getTimestampFast(ResultSetRow.java:1102)
解决方法是: zeroDateTimeBehavior=convertToNull
类似:#MySQL
hibernate.dialect=org.hibernate.dialect.MySQLDialect
validationQuery.sqlserver=SELECT 1
jdbc.url.jeecg=jdbc:mysql://127.0.0.1:3306/jeewx?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
时间: 2024-09-29 02:00:01