Mybatis
文章平均质量分 72
_睶_
大学转专业自学JAVA,19年毕业,SHEIN初级开发-》高级开发
展开
-
mybatis快速更新大量数据
场景:工作中需要通过另一个表算出某字段的和,再更新其关联表的某个字段。数量量约700万,验收环境,2G内存。方案一(不建议使用):通过分页查询(也可以org.apache.ibatis.session.ResultHandler的流操作平滑的通过流一条条查出数据,挺快的),再通过外键查到相关的数据在内存分组求和,更新列表的字段值,然后用流操作foreach挨个update(实体),耗时约6个小时。(其实际等价于一条一条的执行写好的sql执行)方案二(推荐):同样通过分页查询,再通过外键查到相关的数据在内原创 2020-05-25 13:35:49 · 2928 阅读 · 0 评论 -
mybatis查询结果返回为空(NULL)但是查数据库能查到
在自己搭的项目中出现了这个错误。org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: Error instantiating interface com.chun.zeroyuanlottery.mapper.ReviewL...原创 2019-10-10 10:00:28 · 5430 阅读 · 0 评论 -
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
在调试自己的小项目时出现了org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)这个BUG。上网查了很多资料,最后解决了自己的问题,希望能解决你的问题。环境:MySQL5.7SpringBoot 2.13Mybatis 1.3.2等以下为错误日志信息:1)在pom.xml下添加如...原创 2019-10-08 17:29:48 · 2133 阅读 · 0 评论 -
A component required a bean of type 'com.chun.zeroyuanlottery.mapper.MemberMapper' that could not be
使用Springboot搭建环境的时候,出现如下错误。A component required a bean of type ‘com.chun.zeroyuanlottery.mapper.MemberMapper’ that could not be found.原因是SpringBoot无法识别com.chun.zeroyuanlottery.mapper.MemberMapper。...原创 2019-09-30 16:58:34 · 1210 阅读 · 0 评论 -
CDATA[XXX]]的作用
为了防止XML的文本被解析器解析,XML会对它们进行转义,只有 CDATA 区段(CDATA section)中的文本会被解析器忽略。非法字符如下:<&>’"在MybatisMapper.xml编写动态SQL时经常使用到。示例:统计出生日期在dayStart和dayEnd之间的学生 <select id="queryUserByWhere" ...原创 2019-08-23 20:48:58 · 964 阅读 · 0 评论 -
nested exception is org.apache.ibatis.exceptions.TooManyResultsException
接口调试的时候出现了如下错误:{“code”: “-1”,“msg”: “nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 6”,“info”: n...原创 2019-07-27 10:25:33 · 10729 阅读 · 3 评论 -
‘XXX’can not be represented as java.sql.Timestamp
bug如下:Error attempting to get column ‘update_time’ from result set. Cause: java.sql.SQLException: Value ’AKD14120202231Dhttp://img.romwe.com/images/romwe.com/201412/1417510490943529583.jpgNc-594...原创 2019-07-26 15:21:15 · 1181 阅读 · 0 评论 -
关于传递的值是1,2,3字符串如何使用foreach分割遍历的问题
问题描述:在开发过程中由于对字段的进行了修改(由原来的只支持单个值输入,且是字符串型的;变成可支持字符串1,2或者1,3 2,3 等组合),导致页面无法正常加载。发现原因是下面这段Mybatis无法实现需要的功能。部分代码如下: <!-- 使用字符串切割成字符串数组,但是报错--> <if test="type!= null">and o.type in ...原创 2019-07-20 19:03:24 · 856 阅读 · 0 评论 -
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): cn.itcast.mybatis.mapper.UserMapper.queryUserByWhere 无效绑定语句(未找到) at org.apache.ibatis.binding.MapperMetho...原创 2018-04-18 23:36:51 · 439 阅读 · 0 评论 -
Mybatis动态 SQL
MyBatis 的强大特性之一便是它的动态 SQL。如果你有使用 JDBC 或其它类似框架的经验,你就能体会到根据不同条件拼接 SQL 语句的痛苦。例如拼接时要确保不能忘记添加必要的空格,还要注意去掉列表最后一个列名的逗号。利用动态 SQL 这一特性可以彻底摆脱这种痛苦。 虽然在以前使用动态 SQL 并非一件易事,但正是 MyBatis 提供了可以被用在任意 SQL 映射语句中的强大的动态...原创 2018-04-13 10:45:34 · 697 阅读 · 0 评论 -
Mybatis整合Spring的applicationContext配置
1.DTD information :添加Spring约束(可以添加更多实现更多功能)<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springfram...原创 2018-04-15 09:59:49 · 911 阅读 · 0 评论 -
测试类报错Test cannot be resolved to a type
在搭建一个项目的时候(有用到Spring),编写测试类发现@Test报错 Test cannot be resolved to a typeimport org.junit.Test;则报错 The import org.junit cannot be resolved重新正确导入了JUnit4后(网上大多是有关JUnit导入配置的方法),还是报错,并没有解决问题。如图...原创 2018-04-08 21:21:14 · 8765 阅读 · 2 评论