I just learned JAVA, and I wrote it with reference to the example, but I can’t run it, and the error is:
org.apache.ibatis.exceptions.PersistenceException:
### Error building SqlSession.
### The error may exist in mapper/User.xml
### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 10; columnNumber: 77; 值为 "pojo.User" 的属性 "resultSetType" 必须具有列表 "FORWARD_ONLY SCROLL_INSENSITIVE SCROLL_SENSITIVE " 中的值。
This is how I write it
<mapper namespace="test">
<select id="findUserByID" parameterType="int" resultSetType="pojo.User">
SELECT * FROM `user` WHERE id = #{id};
</select>
</mapper>
I wrote pojo.User, and it got an error.
I don’t know how to write Lu Jin here. The project directory is as shown in the picture
phpcn_u15822017-06-23 09:16:12
The return value of MyBatis Select should be explained by ResultType or ResultMap. ResultSetType is an attribute configuration used to control the result set cursor. It can only be one of the three FORWARD_ONLY|SCROLL_SENSITIVE|SCROLL_INSENSITIVE. Generally, this configuration will not be used except in special circumstances. By default, the database handles it by itself.
I think you wrote it wrong here
滿天的星座2017-06-23 09:16:12
Change to array
<mapper namespace="test">
<select id="findUserByID" parameterType="int" resultSetType="pojo.User[]">
SELECT * FROM `user` WHERE id = #{id};
</select>
</mapper>