错误

原配置如下:

    <resultMap id="xxxDetail" type="xxx" extends="xxxResult"><collection property="xxxList" select="selectChildList"column="{groupId=group_id}" /></resultMap>

在原配置基础上新增3个一对一关系,如下:

    <resultMap id="xxxDetail" type="xxx" extends="xxxResult"><collection property="xxxList" select="selectChildList"column="{groupId=group_id}" /><association property="provinceInfo" javaType="SysCity" column="province" select="selectCity" /><association property="cityInfo" javaType="SysCity" column="city" select="selectCity" /><association property="regionInfo" javaType="SysCity" column="region" select="selectCity" /></resultMap>

遇到错误:Caused by: org.xml.sax.SAXParseException: 元素类型为 "resultMap" 的内容必须匹配 "(constructor?,id*,result*,association*,collection*,discriminator?)"。

错误原因

映射文件mapping.xml 中的resultMap中的元素顺序必须符合constructor?,id*,result*,association*,collection*,discriminator?)。即,associationcollection 前面。

解决办法

调整顺序,如下:

    <resultMap id="xxxDetail" type="xxx" extends="xxxResult"><association property="provinceInfo" javaType="SysCity" column="province" select="selectCity" /><association property="cityInfo" javaType="SysCity" column="city" select="selectCity" /><association property="regionInfo" javaType="SysCity" column="region" select="selectCity" /><collection property="xxxList" select="selectChildList"column="{groupId=group_id}" /></resultMap>

元素类型为 “resultMap” 的内容必须匹配 “(constructor?,id*,result*,association*,collection*,discriminator?)”相关推荐

  1. mybatis元素类型为 “resultMap“ 的内容必须匹配 “(constructor?,id *,result*,association报错解决

    1.前言 太久没写这种套娃式的sql语句了,导致今天一写,直接给我整了个报错. 原因其实蛮简单的,mybatis的xml中的resultMap标签规定了内标签的顺序,写错了就会直接解析不出来,从而报错 ...

  2. MyBatis中提示:元素类型为 mapper 的内容必须匹配 (cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|de

    场景 整合MyBatis后运行项目提示: 元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap ...

  3. 元素类型为 mapper 的内容必须匹配 (cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|selec

    在配置ssm框架的时候,写mapper映射文件的时候,总是会想写一些注解. 可是在编译的时候会出现这个bug,是因为在前面写了注释.导致了执行顺序的问题.需要把一些注释删掉,就可以正常执行了. 像这样 ...

  4. 元素类型为 “mapper“ 的内容必须匹配 “(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|selec

    一.报错图片 二.解决 出现这个问题原因有很多,如注释不规范,或者里面多写了多余符号.简而言之,就是.xml文件书写不规范. 比如我,就是这里多写了符号 三.解决思路 本篇文章想吐槽的点在这里 结合最 ...

  5. Struts2项目.xml文件配置错误:元素类型为 package 的内容必须匹配 (result-types?,interceptors?,default-interceptor-ref?,d...

    配置文件要严格按照以下顺序: result-types interceptors default-interceptor-ref default-action-ref default-class-re ...

  6. mybatis项目启动报错 The content of element type resultMap must match (constructor?,id*,result*,associat...

    启动项目报错 2018-02-26 17:09:51,535 ERROR [org.springframework.web.context.ContextLoader] - Context initi ...

  7. xpath爬取airbnb民宿价格信息,为啥用属性定位不到元素,但是用文本内容模糊匹配却可以

    超级小白,刚刚接触python.今天想要试着爬一下爱彼迎上的民宿信息,包括房屋情况.位置.价格三个信息: 我一开始的代码是这样的: 前两个信息都可以用find_elements_by_xpath很容易 ...

  8. 内容必须匹配 (cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|selec

    元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update ...

  9. mybatis configuration的内容必须匹配问题

    问题:今天在写mybatis plugin插件的时候碰到如下错误: org.apache.ibatis.exceptions.PersistenceException: ### Error build ...

最新文章

  1. 中国互联网+光伏逆变器行业商业模式创新与投资机会深度研究报告
  2. HDU2015 偶数求和
  3. 理解SVN中trunk,branches,tags
  4. java基础将字符串进行反转
  5. 刘意 java基础视频_传智播客 2015年 刘意_Java基础视频-深入浅出精华版 笔记(day21~day23)(2016年4月8日13:28:21)...
  6. 微机8088主板图绘制
  7. vs2012 链接内置数据库 sql express 出现error 26 解决方法
  8. 简单易用的C/C++ 图像库 stb_image stb_image_write
  9. 互联网公司的几种销售模式
  10. 你有哪些学习英语的软件可以推荐的吗?
  11. 需求分析师如何提高核心竞争力
  12. 数据埋点几种方式介绍
  13. 第5章 CUDA存储器
  14. Leetcode 576. 出界的路径数
  15. 微信小程序识别二维码参数
  16. mooc幕课零基础学Java语言(翁恺)if-else语句比较三个数, 输出最大值
  17. Flink 流批一体一站式平台 StreamX 来袭
  18. iOS网络资源汇总(值得推荐)
  19. 出租车计价器的设计二
  20. dnf从0开始写辅助

热门文章

  1. 常用的7大排序算法汇总
  2. 【ARM】一步一步移植Linux Kernel 2.6.13到板子
  3. C/C++通用Makefile
  4. magento 让某个页面开启SSL访问
  5. mysql导入sql文件
  6. C++ 字符数组函数与string函数
  7. W3wp.exe占用CPU及内存资源
  8. 关于Oracle AUTONOMOUS TRANSACTION(自治事务)的介绍
  9. 网站安全狗”响应内容保护“网页错误返回页面优化功能介绍
  10. linux crontab 每隔10秒执行一次