![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
mybatis
男人要霸气
这个作者很懒,什么都没留下…
展开
-
Mybatis-plus中数据库有关键字的坑
@TableField("`usage`")private BigDecimal usage;切记:不要写成这样@TableField("usage")原创 2021-02-25 10:26:51 · 950 阅读 · 0 评论 -
Mybatis-plus中新增数据的ID那么大? 如何解决
mybatis-plus: mapper-locations: - classpath:mapper/*.xml global-config: db-config: id-type: auto configuration: map-underscore-to-camel-case: true原创 2020-11-13 11:12:19 · 1441 阅读 · 5 评论 -
The XML location is 'file [D:XXXXXX/mybatis-conf.xml] Cause: java.lang.NullPointerException
完整错误:Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to...转载 2020-01-09 09:50:15 · 262 阅读 · 0 评论 -
Mybatis 批量插入
mapper接口int addBatchFarmDevice(@Param("devices") List<FarmDevice> devices); 注意:@Param(“devices”)注解不能省mapper.xml <insert id="addBatchFarmDevice" parameterType="java.util.List"> ...原创 2019-11-18 18:14:22 · 113 阅读 · 0 评论 -
tk.mybatis通用插件updateByPrimaryKeySelective无法更新数据库
今天在SSM框架中使用Mybatis的tk.mybatis通用插件时,使用updateByPrimaryKeySelective方法更新数据库表失败Preparing: UPDATE User SET id = ?, email = ?, password = ?, phone = ?, nick_Name = ?, state = ?, img_Url = ?, enable = ? WHER...转载 2019-10-22 14:47:22 · 952 阅读 · 0 评论 -
Field studentMapper in StudentServic required a bean of type 'StudentMapper' that could not be found
错误如下:解决方案:在启动类上加上@MapperScan注解(写mapper包的路径)原创 2019-08-18 12:53:17 · 1721 阅读 · 0 评论 -
Mybatis mysql模糊查询(CONCAT多个字段)及bug
先看下如下xml SELECT t.id, t.mobile,, t.account_name FROM t_account t WHERE 1=1 <if test="keyWord !=null and keyWord !=''"> and CONCAT(t.id,t.mobile,t.account_n...原创 2019-07-09 21:44:28 · 7408 阅读 · 8 评论 -
MyBatis逆向工程及Example的用法
点击查看:https://blog.csdn.net/qq_39056805/article/details/80585941原创 2019-04-16 19:51:40 · 328 阅读 · 0 评论 -
Expected one result (or null) to be returned by selectOne(), but found: 3
以下是mybatis中报的错误,错误:Expected one result (or null) to be returned by selectOne(), but found: 3这是因为(我只要一个对象,却发现返回给我3个对象)因此就会报错mapper接口中的返回值是对象把返回值改为List即可解决!!!!...原创 2019-03-05 14:15:47 · 19604 阅读 · 3 评论 -
invalid comparison: java.util.Date and java.lang.String
因为:mybatis 3.3.0中对于时间参数进行比较时的一个bug. 如果拿传入的时间类型参数与空字符串’'进行对比判断则会引发异常. 所以在上面的代码中去该该判断, 只保留非空判断就正常了解决如下:将判空去掉,改为:问题解决!!!!...原创 2019-02-25 16:02:11 · 1051 阅读 · 0 评论 -
Parameter 'dealercode' not found. Available parameters are [dealerProductVo, param1]
在用mybatis过程中,遇到了这个错误。Parameter 'dealercode' not found. Available parameters are [dealerProductVo, param1]经过盘查发现,所以mapper接口和xml文件都是正确的,最后找出了问题所在,因为用**@Param**指定参数,mybatis会认为传的是一个参数而不是一个对象,所以就会爆了错...原创 2019-01-17 12:25:56 · 819 阅读 · 0 评论