美文网首页
mybatis常见错误

mybatis常见错误

作者: 缘木与鱼 | 来源:发表于2019-11-30 16:42 被阅读0次

java.lang.UnsupportedOperationException 错误如下

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.lang.UnsupportedOperationException
......
### SQL: select order_id from `order`
### Cause: java.lang.UnsupportedOperationException

错误代码

// mapper的接口层代码:
public List getOrderIds();

// mapper.xml 中的代码
<select id="getOrderIds" resultType="java.util.List">
     select order_id from `order`
</select>

改正以后 resultType

// mapper的接口层代码:
public List<Integer> getOrderIds();

// mapper.xml 中的代码
<select id="getOrderIds" resultType="int">
    select order_id from `order`
</select>

相关文章

网友评论

      本文标题:mybatis常见错误

      本文链接:https://www.haomeiwen.com/subject/sxwowctx.html