建筑公司网站管理员,招标网官网下载,网站建设分配人员方案,基于jsp的社团组织网站建设使用 Mapper 读取数据库数据时#xff0c;因时间字段为 null, Java设置该字段为 Instant, 在Mapper转为 List时出了错误#xff0c;如果使用 List则不抛异常。但实际情况我们还是希望使用原数据对象#xff0c;导致抛出下面错误Error attempting to get column create_time …使用 Mapper 读取数据库数据时因时间字段为 null, Java设置该字段为 Instant, 在Mapper转为 List时出了错误如果使用 List则不抛异常。但实际情况我们还是希望使用原数据对象导致抛出下面错误Error attempting to get column create_time from result set. Cause: java.sql.SQLException: Zero date value prohibited; Zero date value prohibited; nested exception is java.sql.SQLException: Zero date value prohibited解决方法数据库连接语句添加上zeroDateTimeBehaviorCONVERT_TO_NULL例如jdbc:mysql://localhost:3306/db_test?serverTimezoneUTCzeroDateTimeBehaviorCONVERT_TO_NULL里面还介绍了 zeroDateTimeBehavior的几种配置exception(默认)CONVERT_TO_NULL roundCONVERT_TO_NULL 是把 null 转成 0000-00-00 00:00:00rand 是 把 null 转为 0001-01-01 14:00:00 (具体没有亲测 )(72)文章为个人原创如需转载请注明出处。谢谢