解决MyBatisPlus+Druid异常:java.sql.SQLFeatureNotSupportedException

报错详情:
MyBatisPlus 3.3.1 + Druid 1.2.20在处理LocalDateTime字段时报错如下:

Error attempting to get column 'create_time' from result set.
Cause: java.sql.SQLFeatureNotSupportedException

报错原因:
报错来自Druid的版本问题,在1.1.21版本之前不支持LocalDateTime等新日期类型处理方式。而MyBatisPlus 自3.3.1版本开始使用了新版jdbc,支持新的日期类型。

解决办法:

  • (推荐) 升级Druid1.2.21
  • (不推荐) 切换DruidHikariCP
  • (不推荐) 降MyBatisPlus3.1.0,弃用LocalDateTime等新日期类型;
@Builder @Data @ToString @AllArgsConstructor @TableName(autoResultMap = true, value = "mcr_crs_rule") public class MCRCrsRule extends BaseModel { private String ruleId; private String ruleName; private Integer syncScene; private Integer syncMode; private String srcInstanceId; private String srcNamespaceId; private String srcRepoRegex; private String srcTagRegex; private String destInstanceId; private String destNsId; private String destAccount; private String destRegistryAddress; private String destRegistryNamespace; private String destLoginAccount; private String destLoginPwd; private Integer ruleEnabled; private Integer ruleCleaned; private Integer ruleTriggerType; private String cron; private Integer coverExistImage; private Date lastExecutionTime; private Date nextExecutionTime; } <select id="selectListMCRRuleInfoByInstanceId" parameterType="string" resultMap="mcrCrsRuleResultMap"> select * from mcr_crs_rule where src_instance_id =#{value} and deleted = 0 </select> <resultMap id="mcrCrsRuleResultMap" type="com.msxf.cloud.model.dao.MCRCrsRule"> <id column="id" property="id"/> <result column="rule_id" property="ruleId"/> <result column="rule_name" property="ruleName"/> <result column="sync_scene" property="syncScene"/> <result column="sync_mode" property="syncMode"/> <result column="src_instance_id" property="srcInstanceId"/> <result column="src_namespace_id" property="srcNamespaceId"/> <result column="src_repo_regex" property="srcRepoRegex"/> <result column="src_tag_regex" property="srcTagRegex"/> <result column="dest_instance_id" property="destInstanceId"/> <result column="dest_ns_id" property="destNsId"/> <result column="dest_account" property="destAccount"/> <result column="dest_registry_address" property="destRegistryAddress"/> <result column="dest_registry_namespace" property="destRegistryNamespace"/> <result column="dest_login_account" property="destLoginAccount"/> <result column="dest_login_pwd" property="destLoginPwd"/> <result column="rule_enabled" property="ruleEnabled"/> <result column="rule_cleaned" property="ruleCleaned"/> <result column="rule_trigger_type" property="ruleTriggerType"/> <result column="cron" property="cron"/> <result column="cover_exist_image" property="coverExistImage"/> <result column="last_execution_time" property="lastExecutionTime"/> <result column="next_execution_time" property="nextExecutionTime"/> <result column="create_time" property="createTime"/> <result column="created_by" property="createdBy"/> <result column="update_time" property="updateTime"/> <result column="updated_by" property="updatedBy"/> <result column="delete_time" property="deleteTime"/> <result column="deleted_by" property="deletedBy"/> <result column="deleted" property="deleted"/> </resultMap> org.springframework.jdbc.UncategorizedSQLException: Error attempting to get column 'rule_name' from result set. Cause: java.sql.SQLException: Error ; uncategorized SQLException; SQL state [null]; error code [0]; Error; nested exception is java.sql.SQLException: Error
最新发布
10-24
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值