zoukankan      html  css  js  c++  java
  • springboot报错_必须为元素类型 "insert" 声明属性 "resultMap"的解决

    一、问题

    报错:必须为元素类型 "insert" 声明属性 "resultMap"的解决。

    代码:

            <resultMap id="result" type="com.example.demo.bean.Node">
    		<result property="nodeID" column="nodeID" />
    		<result property="nodeType" column="nodeType" />
    		<result property="relation" column="relation" />
    	</resultMap>
     
    	<insert id="addNode" parameterType="com.example.demo.bean.Node"
    		keyProperty="nodeID" useGeneratedKeys="true" resultMap="java.lang.Integer">
    		INSERT INTO tb_nodetree
    		(
    		nodeId,nodeType,relation
    		)
    		VALUES (
    		#{nodeId},#{nodeType},#{relation}
    		)
    	</insert>    
    

    2.原因

    因为接口中想返回一个整数来查看是否添加进数据库,所以在insert方法中加了resultMap属性,结果就出错了。

    3.解决

    把insert中的resultMap删掉就行了,仍然会返回整数(数据库受影响的行数)。

  • 相关阅读:
    手机APP漏洞
    测试用例的优先级的概念
    测试出现BUG的理论逻辑
    django-redis 中文文档
    DRF单表序列化和反序列化
    事件
    QT文件操作
    一道字符串题目
    明日方舟六星出货率
    简易图片查看器
  • 原文地址:https://www.cnblogs.com/smxbo/p/13160466.html
Copyright © 2011-2022 走看看