Mybatis-plus报错:Error attempting to get column ‘createDate‘ from result set.

Error attempting to get column 'createDate' from result set.


springboot项目,关于InvalidDataAccessApiUsageException: Error attempting to get column ‘createTime’ from result set. Cause: java.sql.SQLFeatureNotSupportedException ; null; nested exception is java.sql.SQLFeatureNotSupportedException的解决办法。

swagger测试接口报错:

{
  "timestamp": "2021-05-03T06:49:19.496+00:00",
  "status": 500,
  "error": "Internal Server Error",
  "message": "",
  "path": "/system/cfg/pos/"
}

后端控制台报错:

 Error attempting to get column 'createDate' from result set.  Cause: java.sql.SQLFeatureNotSupportedException
; null; nested exception is java.sql.SQLFeatureNotSupportedException] with root cause

java.sql.SQLFeatureNotSupportedException: null
	at com.alibaba.druid.pool.DruidPooledResultSet.getObject(DruidPooledResultSet.java:1771) ~[druid-1.1.10.jar:1.1.10]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_152]
	

报错原因

因为我在项目中使用了Mybati-plus,同时使用了druid数据源,由于druid数据源的版本太低,不支持JDK8中的LocalDate、LocalTime、LocalDateTime等日期类型,所以解决方案就是下载新版本的druid依赖。

解决方法

换用版本高于或等于1.1.21以上的jar包

<!--druid 数据源-->
<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>druid-spring-boot-starter</artifactId>
    <version>1.1.21</version>
</dependency>

换用高版本的druid数据源

[
  {
    "id": 1,
    "name": "技术总监",
    "createDate": "2020-03-31",
    "enabled": true
  },
  {
    "id": 2,
    "name": "运营总监",
    "createDate": "2020-03-31",
    "enabled": true
  },
  {
    "id": 3,
    "name": "市场总监",
    "createDate": "2020-03-31",
    "enabled": true
  },
  {
    "id": 4,
    "name": "研发工程师",
    "createDate": "2020-03-31",
    "enabled": true
  },
  {
    "id": 5,
    "name": "运维工程师",
    "createDate": "2020-03-31",
    "enabled": true
  }
]

完美解决!!!!

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值