ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

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

2021-05-03 14:57:13  阅读:862  来源: 互联网

标签:03 set java name get createDate druid 报错


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
  }
]

完美解决!!!!

标签:03,set,java,name,get,createDate,druid,报错
来源: https://blog.csdn.net/weixin_45630735/article/details/116376813

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有