mybatis-plus和阿里的druid冲突异常
报错如下:
org.springframework.dao.InvalidDataAccessApiUsageException: Error attempting to get column 'create_time' from result set. Cause: java.sql.SQLFeatureNotSupportedException
; null; nested exception is java.sql.SQLFeatureNotSupportedException
当时我用mybtis-plus 自动生成代码,数据库时间格式对应生成实体字段为LocalDateTime,因为我从来没有用过该对象,所以在报错时我第一反应就是这个数据格式转换有问题。但是当拷贝百度这个异常后,网上反应是druid版本的问题。当时我maven的配置如下图:
<!-- 引入 Druid 数据源依赖:https://mvnrepository.com/artifact/com.alibaba/druid -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.10</version>
</dependency>
<!-- Mybatis Plus -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.1.0</version>
</dependency>
解决办法:
改变druid的版本号,提高版本
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.18</version>
</dependency>