mybatis: No enum constant org.apache.ibatis.type.JdbcType."VARCHAR"
mybatis 插入的时候一句sql报错如下。
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.BuilderException: Error resolving JdbcType. Cause: java.lang.IllegalArgumentException: No enum constant org.apache.ibatis.type.JdbcType."VARCHAR"
insert into sys_user(
<if test="userId != null and userId != '' ">user_id,</if> create_time
)values(
<if test="userId != null and userId != ''">#{userId,jdbcType="VARCHAR"},</if> sysdate
)
原因在于
#{userId,jdbcType="VARCHAR"},
即mybatis所定义的类型常量枚举不存在,mybatis 解析为了"VARCHAR" 带双引号的字符串,改为
insert into sys_user(
<if test="userId != null and userId != '' ">user_id,</if> create_time
)values(
<if test="userId != null and userId != ''">#{userId,jdbcType=VARCHAR},</if> sysdate
)
把双引号去掉或者直接不写jdbcType 即可。
mybatis: No enum constant org.apache.ibatis.type.JdbcType."VARCHAR"的更多相关文章
- 【myBatis】java.lang.IllegalArgumentException: No enum constant org.apache.ibatis.type.JdbcType.NUMBE
可能#{current_date, jdbcType=VARCHAR}中的VARCHAR类型不对
- No enum constant org.apache.ibatis.type.JdbcType.Integer
同事今天在用mybatis查询时候,报了上面这个问题.上网查了下,原来是mybatis封装类型的问题.原因是在resultMap中jdbcType写为了Integer,但是在MyBatis中没有这个数 ...
- java.lang.IllegalArgumentException: No enum constant org.apache.ibatis.type.JdbcType.Integer
mybatis配置的jdbaType类型要是大写的,否则就会出现此种异常 原因是在xml中配置的 jdbcType中有小写字母
- No enum constant org.apache.ibatis.type.JdbcType.xxx 错误
配置文件Mapper中JdbcType错误,有可能是大小写,有可能是拼写错误
- mybatis No enum const class org.apache.ibatis.type.JdbcType.Date 坑爹的配置
转自:https://lihaiming.iteye.com/blog/2248059 在ibatis中不需要关注这些参数 而转到mybatis后 如果字段值为空 必须设置jdbcType如inser ...
- Mybatis异常--java.lang.IllegalArgumentException: NO ENUM const class org.apache.ibatis.type.JdbcType.int
今天下午写代码时发现一直报错,找了半天都没找到错误原因. 最后才发现原来是XML配置错误,某条属性的JdbcType我按照以前ibatis的习惯写的int,但是Mybatis不识别的. 上Mybati ...
- mybatis No enum const class org.apache.ibatis.type.JdbcType.Integer
mybatis报错:没有Integer这个类型的jdbcType值 原因:mybatis配置重的jdbaType类型要是大写的 如图所示:
- 【异常及源码分析】org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping
一.异常出现的场景 1)异常出现的SQL @Select("SELECT\n" + " id,discount_type ,min_charge, ${cardFee} ...
- java.lang.IllegalArgumentException: No enum constant org.apache.ws.commons.schema.XmlSchemaForm.
一次系统断电维护之后,apache cxf 的 web service 接口调用一直报错: java.lang.IllegalArgumentException: No enum constant o ...
随机推荐
- COM笔记-类厂
CoCreateInstance实际上并没有直接创建COM组件 ,而是创建了一个被称作是类厂的组件.而所需的组件正是由些类厂创建的.类厂组件的唯一功能就创建其他的组件.创建组件的标准接口是IClass ...
- wpf 的style
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x ...
- WPF 自己做一个颜色选择器
程序开发过程中,经常会遇到需要支持动态配置主题颜色的问题,通常,一个程序会有多种不同的颜色风格主题供选 有时候,更细致一些的地方,会需要支持自己配置颜色,这样我们就需要一个颜色选择器啦,下面是我自己开 ...
- jsoup的Element类
一.简介 该类是Node的直接子类,同样实现了可克隆接口.类声明:public class Element extends Node 它表示由一个标签名,多个属性和子节点组成的html元素.从这个元素 ...
- 13.SpringMVC之全局异常
我们知道,系统中异常包括:编译时异常和运行时异常RuntimeException,前者通过捕获异常从而获取异常信息,后者主要通过规范代码开发.测试通过手段减少运行时异常的发生.在开发中,不管是dao层 ...
- 后端开发应该掌握的Redis基础
转自:https://juejin.im/post/5d078cd6f265da1b8466e62c 在上一篇文章中,我们简单地讲了一下Redis的应用场景.安装.如何连接等比较基础的知识,那么在这篇 ...
- Alibaba cloud 3 安装docker
最近因为公司买阿里服务器装的 Alibaba cloud Linux 系统,在部署环境的时候也是遇到各种坑,网上教程大多都是其他系统的,今天就来分享一下自己安装Docker的步骤,同时也是给自己记录一 ...
- java的stream的使用
过滤 filter: //匹配第一个元素 Optional<Integer> findFirst=list.stream().filter(x->x>6).findFirst( ...
- super的两个作用
super与实例没有什么关系,它本身有两个作用的,参考如下理解: 1.super可以当函数用.super作为函数调用时,表示父类的构造函数.示例: class Par { constructor() ...
- Pycharm去除波浪线等相关操作