天天看点

Cause: java.lang.UnsupportedOperationException

org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.lang.UnsupportedOperationException
### The error may exist in mapper/UserMapper.xml
### The error may involve mapper.UserMapper.findUser-Inline
### The error occurred while setting parameters
### SQL: select * from user where              user.id in(                   ?              ,                  ?              )
### Cause: java.lang.UnsupportedOperationException
           

如题,不支持操作异常。

把resultType的属性值改一下。这里需要注意,如果你想要查询的返回值是list,你需要把resultType改成pojo.User,而不是java.util.List。

原先的代码。

<select id="findUser" resultType="java.util.List" parameterType="pojo.UserQueryVo">
        select * from user where
        <foreach collection="list" open="user.id in(" close=")" separator="," item="id">
            #{id}
        </foreach>
    </select>
           

更改后的代码

<select id="findUser" resultType="pojo.User" parameterType="pojo.UserQueryVo">
        select * from user where
        <foreach collection="list" open="user.id in(" close=")" separator="," item="id">
            #{id}
        </foreach>
    </select>
           
web