必须为元素类型 “mapper” 声明属性 “namespace” 或The content of element type “mapper” must match “EMPTY”

2022-06-30 13:25:11 浏览数 (1)

代码语言:javascript复制
<?xml version="1.0" encoding="UTF-8"?>  
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">    
<mapper namespace = "com.introduce.Modle.User2">
	<resultMap type="com.introduce.Model.User2" id="user2ResultMap">
		<result property="name" column="name" />
		<result property="age" column="age" />
		<result property="sex" column="sex" />
	</resultMap>
	<select id="getUser2" resultMap="user2ResultMap">
		<![CDATA[select * from User2 where name=#{name}]]>
	</select>
	
</mapper>

只需把<!DOCTYPE mapper PUBLIC “-//mybatis.org//DTD Config 3.0//EN” “http://mybatis.org/dtd/mybatis-3-config.dtd”>

这行中的两处config 改成mapper即可

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/106275.html原文链接:https://javaforall.cn

0 人点赞