MyBatis遇到org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:Error querying database.Cause: java.lang.UnsupportedOperationExceptionThe error may exi
·
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
Error querying database. Cause: java.lang.UnsupportedOperationException
The error may exist in file [F:\IDEA_Project\aidp\target\classes\com.hikvision.aidp.mapper\PlanInfoMapper.xml]
The error may involve com.hikvision.aidp.mapper.PlanInfoMapper.getPlan
The error occurred while handling results
SQL: select plan_id, plan_name from plan_info
Cause: java.lang.UnsupportedOperationException

解决方法
出错:
<select id="getPlan" resultType="java.util.List">
select plan_id, plan_name from plan_info
</select>
出错原因:大致意思就是设置的参数有问题。原因就在于mapper.xml的resultType代表的是List中的元素类型,而不应该是List本身,所以修改mapper.xml文件为:
修改后:
<select id="getPlan" resultType="com.hikvision.aidp.entity.PlanInfo">
select plan_id, plan_name from plan_info
</select>
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐
所有评论(0)