JAVA mybatis pojo.xml configuration problem
某草草
某草草 2017-06-23 09:14:12
0
3
941

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

某草草
某草草

reply all(3)
phpcn_u1582

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

typecho

resultSetType finished changing resultType ?

滿天的星座

Change to array

<mapper namespace="test">
    <select id="findUserByID" parameterType="int" resultSetType="pojo.User[]">
        SELECT * FROM `user` WHERE id = #{id};
    </select>
</mapper>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template