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 ...
随机推荐
- JAVA集合类(代码手写实现,全面梳理)
参考网址:https://blog.csdn.net/weixin_41231928/article/details/103413167 目录 一.集合类关系图 二.Iterator 三.ListIt ...
- C++继承体系中的内存分段
---------------综述与目录-------------- 讨论这个问题之前我们先明确类的结构,一个类的大概组成,下面的很多分类名词都是我个人杜撰,为的就是让读者看懂能够区分,下面分别分类: ...
- C#多线程---Mutex类实现线程同步
一.例子 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 ...
- mysql 8.0 1405的坑
因版本差异:password 可能对应:authentication_string字段 不行的话再尝试一下,并且修改下密码类型 ALTER USER 'root'@'%' IDENTIFIED WI ...
- 前端调用后台接口下载word文档的两种方法
1传统的ajax虽然能提交到后台,但是返回的数据被解析成json,html,text等字符串,无法响应浏览器下载.就算使用bob模拟下载,数据量大时也不方便 废话不多说:上代码(此处是Layui监听提 ...
- iGuard和NFS文件同步的解决方案
一般来说,从文件系统中获得文件变化信息,调用操作系统提供的 API 即可.Windows 操作系统上有个名为 ReadDirectoryChangesW 的 API 接口,只要监视一个目录路径就可以获 ...
- 1.3w字,一文详解死锁!
死锁(Dead Lock)指的是两个或两个以上的运算单元(进程.线程或协程),都在等待对方停止执行,以取得系统资源,但是没有一方提前退出,就称为死锁. 1.死锁演示 死锁的形成分为两个方面,一个是使用 ...
- MySQL主主互备不同步的解决方法
MySQL主主互备不同步 首先在服务器上执行show slave satus;可以看到很多同步的参数: Master_Log_File: SLAVE中的I/O线程当前正在读取的主服务器二进制日志文件的 ...
- 一、自动化监控利器-Zabbix
目录 1. 监控的作用 1.1 为何需要监控系统 1.2 监控系统的实现 1.3 常用的监控软件 2. Zabbix简介 2.1 选择Zabbix的理由 2.2 Zabbix的功能特性 3. Zabb ...
- openswan协商流程之(七):main_inR3
主模式第六包(收包):main_inR3 1. 序言 main_inR3()函数是ISAKMP协商过程中第一阶段的最后一个报文的接收处理函数,它的作用同main_inI3_outR3()部分功能相同: ...