
mybatis
唱响星河
内向--内心向往第一
展开
-
Could not autowire No beans of BookMapper type found
在springboot中controller调用mapper文件后报错@AutowiredBookMapper1 bookMapper1;正常应该是给BookMapper1多加一个注解@Repository1、@Service用于标注业务层组件2、@Controller用于标注控制层组件(如struts中的action)3、@Repository用于标注数据访问组件,即DAO组件.4、@Component泛指组件,当组件不好归类的时候,我们可以使用这个注解进行标注。...原创 2020-06-07 19:03:26 · 412 阅读 · 0 评论 -
IDEA中添加mybaite-config.xml和mybaits-mapper.xml文件
1.Settings--->Editor--->File and Code Templates点击+,填写Name(mybatis-config或者mybatis-mapper)和Extension(xml)config文件添加如下:<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://my原创 2020-06-07 17:32:44 · 228 阅读 · 0 评论 -
eclipse中新建mybatis的xml文件
1.下载用到的mybatis文件http://mybatis.org/dtd/mybatis-3-config.dtdhttp://mybatis.org/dtd/mybatis-3-mapper.dtd2.把这两个文件放到eclipse安装目录下3.在eclipse中打开window--preferences--XML--XML Catelog--Add对应的key值为:-//mybatis.org//DTD Config 3.0//EN-//mybatis.or.原创 2020-06-02 09:54:10 · 1246 阅读 · 0 评论 -
java.lang.IllegalArgumentException: Result Maps collection does not contain value for com.hysoft.src
调用mybatis的xml文件时发生如下错误:java.lang.IllegalArgumentException: Result Maps collection does not contain value for com.hysoft.src.model.Book at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:964) ~[mybatis-3.5.4.jar:3.5.4] at ...原创 2020-06-02 09:45:20 · 509 阅读 · 0 评论 -
Error evaluating expression 'XXX'. Return value ('xxxx','xxxxx') was not iterable.
org.apache.ibatis.builder.BuilderException: Error evaluating expression 'XXX'. Return value ('xxxx','xxxxx') was not iterable. at org.apache.ibatis.scripting.xmltags.ExpressionEvaluator.evaluateIt...原创 2019-03-26 17:55:07 · 86109 阅读 · 3 评论 -
mybatis使用in查询时的注意事项
转自:https://www.cnblogs.com/xusir/archive/2013/07/24/3210286.html1. 当查询的参数只有一个时 findByIds(List<Long> ids)1.a 如果参数的类型是List, 则在使用时,collection属性要必须指定为 list <select id="findByIdsM...转载 2019-03-26 17:56:54 · 237 阅读 · 0 评论 -
mybatis处理集合、数组参数使用in查询等语句的两种方法
转自:https://blog.youkuaiyun.com/weixin_38391672/article/details/80701504对于mybatis的参数类型是集合数组的时候进行查询。顺便回忆一下。有两种处理方式。第一种:参数list使用mybatis的标签SELECT* FROMTABLE_NAME AS a WHEREa.id not in #{extraId...转载 2019-03-26 17:58:30 · 1047 阅读 · 0 评论 -
mybatis映射异常:nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter
用Mybatis写动态sql使用if判断的时候报错原sql语句是:<select id="getFkdw" resultMap="BmCodeItem"> select distinct t.* from w_bm_code_item t,w_bm_fkdw_bmxmb b,w_pm_project_dept_fpry p where p.xmb...原创 2019-07-18 10:05:38 · 6466 阅读 · 1 评论