当前位置: 移动技术网 > IT编程>开发语言>Java > mybatis_ The content of element type association must match (constructor,id,result,ass ociation,collection,discriminator)

mybatis_ The content of element type association must match (constructor,id,result,ass ociation,collection,discriminator)

2019年03月04日  | 移动技术网IT编程  | 我要评论

 

一般遇到这种问题肯定要看一看association中元素编写顺序,

 

<resultmap id="orderrslmap" type="orders">
    <id property="id" column="id"></id>
    <result property="number" column="number"></result>
    <result property="createtime" column="createtime"></result>
    <result property="note" column="note"></result>
    <!--
    property:为order类中属性
    javatype:为具体类的类型
    -->
    <!-- 往orders的user匹配数据,模型里有模型,使用association来配置-->
    <association property="user" javatype="user">
        `<id property="id" column="user_id"></id>
        <result property="username" column="username"></result>
        <result property="address" column="address"></result>
    </association>
</resultmap>

 

仔细观察几遍都没看出什么

很无语纠结,重新写一遍没有错误

 

反复对照,才发现在id元素前面多了一个 `

 

浪费了10分钟,记录一下,算个教训

 

使用idea我是把`设置成快捷键,发生这个错误也是正常,下次注意!

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网