实体用的LocalDateTime类型,mysql用的datetime类型,按道理来说不应该报错,为啥还说类型不正确呢?

Cause: com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Incorrect datetime value: '{"month":"MARCH","year":2022,"dayOfMonth":11,"hour":18,"minute":25,"monthValue":3,"nano":446000000,"second":18,"dayOfWeek":"FRID' for column 'register_date' at row 1
; Data truncation: Incorrect datetime value: '{"month":"MARCH","year":2022,"dayOfMonth":11,"hour":18,"minute":25,"monthValue":3,"nano":446000000,"second":18,"dayOfWeek":"FRID' for column 'register_date' at row 1; nested exception is com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Incorrect datetime value: '{"month":"MARCH","year":2022,"dayOfMonth":11,"hour":18,"minute":25,"monthValue":3,"nano":446000000,"second":18,"dayOfWeek":"FRID' for column 'register_date' at row 1] with root cause
com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Incorrect datetime value: '{"month":"MARCH","year":2022,"dayOfMonth":11,"hour":18,"minute":25,"monthValue":3,"nano":446000000,"second":18,"dayOfWeek":"FRID' for column 'register_date' at row 1

at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:104)


回答:

执行操作的代码贴一下
确认自己用的库支持javatime api


回答:

可以将 LocalDateTime 换成 Instant

以上是 实体用的LocalDateTime类型,mysql用的datetime类型,按道理来说不应该报错,为啥还说类型不正确呢? 的全部内容, 来源链接: utcz.com/p/944373.html

回到顶部