问答详情
源自:3-6 dao层开发

Caused by: org.xml.sax.SAXParseException; lineNumber: 19; columnNumber: 65; 必须为元素类型 "insert" 声明属性 "useGeneratedkeys"。

Caused by: org.xml.sax.SAXParseException; lineNumber: 19; columnNumber: 65; 必须为元素类型 "insert" 声明属性 "useGeneratedkeys"。

<mapper>文件

<insert id="insertCommodity" useGeneratedkeys="true" keyProperty="commodityId" keyColum="commodity_id"
        parameteerType="com.seer.demoshop.entity.Commodity">
    INSERT INTO
    commodity(commodity_id,commodity_name,commodity_sales,create_time,last_edit_time)
    VALUE
    (#{commodityId},#{commodityName},#{commoditySales},#{createTime},#{lastEditTime})
</insert>
<update id="updateCommodityId" resultType="com.seer.demoshop.entity.Commodity">
    UPDATE commodity
    <set>
        <if test="commodityName!=null">commodity_name=#{commodityName},</if>
        <if test="commoditySales!=null">commodity_sales=#{commoditySales},</if>
        <if test="lastEditTime!=null">last_edit_time=#{lastEditTime}</if>
    </set>
    WHERE commodity_id=#{commodityId}
</update>
<delete id="deleteCommodity">
    DELETE FROM
    commodity
    WHERE commodity_id=#{commodityId}
</delete>


提问者:步步Bubu 2019-10-15 23:05

个回答

  • 翔仔
    2019-10-16 00:55:04

    同学好,请仔细区分大小写,是useGeneratedKeys 而非 

    useGeneratedkeys