mybatis报错:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exception

接口配置:

package mybatis.mapper;

import java.util.List;

public interface TestMapper {
	public List selectAllInfo();
}

mapper.xml配置:






  


在使用junit测试时出现以下错误:

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.lang.UnsupportedOperationException
### The error may exist in mybatis/mapper/TestMapper.xml
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: SELECT           ID     FROM TEST
### Cause: java.lang.UnsupportedOperationException

大致意思就是设置的参数有问题。

问题原因:

原因就在于mapper.xml的resultType代表的是List中的元素类型,而不应该是List本身,所以修改mapper.xml文件为:






  









你可能感兴趣的:(mybatis,mybatis,string,exception)