The content of element type “resultMap“ must match “(constructor?,id*,result*,association*,collectio
The content of element type “resultMap” must match “(constructor?,id*,result*,association*,collection*,discriminator?)”
此错误我们可以定位到resultMap内部的匹配列表。问题就是我们绑定的顺序有问题。
以下说明及示例来源官网
你可能想把它映射到一个智能的对象模型,这个对象表示了一篇博客,它由某位作者所写,有很多的博文,每篇博文有零或多条的评论和标签。 我们先来看看下面这个完整的例子,它是一个非常复杂的结果映射(假设作者,博客,博文,评论和标签都是类型别名)。 不用紧张,我们会一步一步地来说明。虽然它看起来令人望而生畏,但其实非常简单。
<!-- 非常复杂的结果映射 -->
<resultMap id="detailedBlogResultMap" type="Blog"><constructor><idArg column="blog_id" javaType="int"/></constructor><result property="title" column="blog_title"/><association property="author" javaType="Author"><id property="id" column="author_id"/><result property="username" column="author_username"/><result property="password" column="author_password"/><result property="email" column="author_email"/><result property="bio" column="author_bio"/><result property="favouriteSection" column="author_favourite_section"/></association><collection property="posts" ofType="Post"><id property="id" column="post_id"/><result property="subject" column="post_subject"/><association property="author" javaType="Author"/><collection property="comments" ofType="Comment"><id property="id" column="comment_id"/></collection><collection property="tags" ofType="Tag" ><id property="id" column="tag_id"/></collection><discriminator javaType="int" column="draft"><case value="1" resultType="DraftPost"/></discriminator></collection></resultMap>
由该示例可得,resultMap的结果集映射必须按照一定特定顺序进行
结果映射(resultMap)顺序:
- constructor : 用于在实例化类时,注入结果到构造方法中
- idArg : ID 参数;标记出作为 ID 的结果可以帮助提高整体性能
- arg : 将被注入到构造方法的一个普通结果
- id : 一个 ID 结果;标记出作为 ID 的结果可以帮助提高整体性能
- result : 注入到字段或 JavaBean 属性的普通结果
- association : 一个复杂类型的关联;许多结果将包装成这种类型嵌套结果映射 – 关联可以是 resultMap 元素,或是对其它结果映射的引用
- collection : 一个复杂类型的集合嵌套结果映射 – 集合可以是 resultMap 元素,或是对其它结果映射的引用
- discriminator : 使用结果值来决定使用哪个 resultMap
- case : 基于某些值的结果映射嵌套结果映射 – case 也是一个结果映射,因此具有相同的结构和元素;或者引用其它的结果映射
The content of element type “resultMap“ must match “(constructor?,id*,result*,association*,collectio相关推荐
- 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 ...
- namespace 或The content of element type mapper must match EMPTY
必须为元素类型 "mapper" 声明属性 "namespace" 或The content of element type "mapper" ...
- The content of element type configuration must match (properties?,settings?,typeAliases?,typeHand...
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration PUBLIC & ...
- The content of element type web-app must match……等 问题之解决办法
在flex整合Java生成的web.xml中添加引用servelet的代码就报错如下: The content of element type "web-app" must mat ...
- The content of element type “mapper“ must match “EMPTY“.错误
<mappers><mapper resource="cn/java/dao/impl/xxx.xml"></mapper></mappe ...
- java项目问题 The content of element type servlet must match (icon?,servlet-name,display-name?,descrip
错误问题:The content of element type "servlet" must match "(icon?,servlet-name,display-na ...
- The content of element type configuration must match (properties?,setting
在运行mybatis配置文件的时候,出现错误: [html] view plain copy Caused by: org.xml.sax.SAXParseException: The conte ...
- arse Error at line 58 column 17: The content of element type struts-config must match (display-na
以前没有接触过struts1的项目 刚上来开发公司来的项目的时候遇到的这个错误. 报错信息: 严重: Parse Error at line 58 column 17: The content of ...
- 元素类型为 “resultMap” 的内容必须匹配 “(constructor?,id*,result*,association*,collection*,discriminator?)”
错误 原配置如下: <resultMap id="xxxDetail" type="xxx" extends="xxxResult"& ...
- mybatis元素类型为 “resultMap“ 的内容必须匹配 “(constructor?,id *,result*,association报错解决
1.前言 太久没写这种套娃式的sql语句了,导致今天一写,直接给我整了个报错. 原因其实蛮简单的,mybatis的xml中的resultMap标签规定了内标签的顺序,写错了就会直接解析不出来,从而报错 ...
最新文章
- 自制单选多选日历文本框文本域控件
- 业务服务管理究竟为何可望而不可及
- AutoLayout代码布局使用大全—一种全新的布局思想
- php页面修改器,读取器/修改器
- 2、C#基础 - Visual Studio 的版本选择和下载
- LINQ to SQL 系列 如何使用LINQ to SQL插入、修改、删除数据
- ios 简单的计时器游戏 NSUserDefaults NSDate NSTimer
- python随机生成一个地区地址_利用Python生成随机的IP地址
- linux安装音乐软件下载,网易云音乐Linux版
- 又是灵格斯导致软件自动关闭
- 上位机发送FINS UDP命令读写欧姆龙PLC数据
- css3动画停留在最后一帧
- mysql数据查询(DQL)
- 初学者教程:3D打印后期处理
- # 工欲善其事必先利其器-C语言拓展--嵌入式C语言(八)
- 物理学的困惑: 科学的道德规范和伦理观
- 计算机杰出天才:阿兰·图灵 谜样的大师
- 青春痘的日常治疗方法
- 截至2020年3月,所有与Android Auto兼容的汽车
- 运维工程师和运维开发工程师区别有哪些?
热门文章
- font-awesome在Vue项目中的使用(npm使用)
- 微信小程序获取是android还是ios,微信小程序-手机操作系统以及微信版本判断
- mysql事务的两点特性_MySQL基础篇(06):事务管理,锁机制案例详解
- 安卓期末作品小项目_学在澎雅 | 探索红叶李,闯关我最棒——杭州市澎雅小学二年级期末游园活动...
- wdcp v2.5.15 php版本,linux服务器/虚拟主机管理系统wdcp v2.5.6版本发布
- 汽车方向盘电子助力转向器如何接线_案例 | 看3D打印如何助力汽车电子连接器模具冷却水路的设计优化...
- 缺少 mysql 扩展_解决phpmyadmin中缺少mysqli扩展问题的方法
- 用python计算有效前沿_15个好用到哭的python库,太牛了!
- mysql的常见命令与语法规范
- 代码高亮_安卓集成代码高亮显示开源包