我很难让我的简单 mybatis 文件正常工作。我有这个文件:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="truthtree.model.mysql.UserMapper">
<typeAlias alias="User" type="truthtree.model.mysql.User" />
<select id="getAllUsers" resultType="User">
select * from User
</select>
<select id="findUserByID" resultType="User">
select *
from User
where id=#{id,javaType=int}
</select>
<select id="findByNameAndPassword" resultType="User">
select *
from User
where name = #{name,javaType=String}
and password = #{password,javaType=String}
</select>
</mapper>
我得到以下异常:
引起:org.xml.sax.SAXParseException:元素类型“mapper”的内容必须匹配“(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*) +”。
这很令人困惑,因为我肯定有一些 s 在那里。任何想法这里可能有什么问题?谢谢!