MyBatis: java.lang.UnsupportedOperationException exception solution

An error occurred:

sql statement:

<select id="selectAllUser" resultType="java.util.List">
        select *
        from users 
</select>

Corresponding Dao interface:

List<UsersEntity> selectAllUser();

 

The correct wording: the sql statement resultType = "java.util.List" changed resultType = "UsersEntity" to

sql statement:

<select id="selectAllUser" resultType="UsersEntity">
        select *
        from users 
</select>

Corresponding Dao interface:

List<UsersEntity> selectAllUser();

 

Reason: resultType represents the element type in the List, not the List itself.

Remember: resultType returns the type of elements in the collection, not the collection itself

Guess you like

Origin blog.csdn.net/weixin_38676276/article/details/87740303