Error attempting to get column ‘xx‘ from result set. Cause: java.sql.SQLFeatureNotSupportedException
阿新 • • 發佈:2021-02-20
mybatis-plus 中使用LocalDateTime報錯:Error attempting to get column 'create_time' from result set. Cause: java.sql.SQLFeatureNotSupportedException
問題描述:
mybatis-plus 3.3.2 ,druid連線池:1.1.10 ,資料庫中的時間型別是: datetime ,實體中是Localdatetime 型別的, 導致查詢直接會報上面截圖的問題
最後發現是整合 druid的問題,整合druid資料來源,使用3.1.0之前版本沒問題,升級mp到3.1.1+後,執行時報錯:java.sql.SQLFeatureNotSupportedException
<!-- mybatis-plus --> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.3.2</version> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> <version>1.1.10</version> </dependency>
問題原因:mybaits-plus 3.1.1+使用了新版jdbc,LocalDateTime等新日期型別處理方式升級,但druid在1.1.21版本之前不支援
解決方案:
1. 升級druid到1.1.21解決這個問題;
2.保持mp版本3.1.0;
3.緊跟mp版本,換掉druid資料來源(我採用的:果斷換掉druid,實用boot預設的)