使用mybatis报错UnsupportedOperationException
1.Mapper.java类如下:
List<String> getMatchAddress(String com);
2.Mapper.xml如下:
<select id="getMatchAddress" parameterType="java.lang.String" resultType="java.util.List">
select t.address from tablename where t.company=#{com}
</select>
然后报错UnsupportedOperationException
3.应改为
<select id="getMatchAddress" parameterType="java.lang.String" resultType="java.lang.String">
select t.address from tablename where t.company=#{com}
</select>
切记:resultType返回的是集合中的元素类型,而不是集合本身