mybatis-PersistenceException-IncompleteElementException: Could not find result map

原因

  • 误将mapper.xml中resultType写成了resultMap

  • 关键报错: Could not find result map

        
    

报错信息

org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: org.apache.ibatis.builder.IncompleteElementException: Could not find result map 'com.dayu.mybatis.simple.model.Country' referenced from 'com.dayu.mybatis.simple.mapper.CountryMapper.selectAll'
### Cause: org.apache.ibatis.builder.IncompleteElementException: Could not find result map 'com.dayu.mybatis.simple.model.Country' referenced from 'com.dayu.mybatis.simple.mapper.CountryMapper.selectAll'

	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:135)
	at com.dayu.mybatis.simple.mapper.CountryMapperTest.testSelectAll(CountryMapperTest.java:41)
	... 29 more
Caused by: java.lang.IllegalArgumentException: Result Maps collection does not contain value for com.dayu.mybatis.simple.model.Country
	at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:964)
	at org.apache.ibatis.session.Configuration.getResultMap(Configuration.java:674)
	at org.apache.ibatis.builder.MapperBuilderAssistant.getStatementResultMaps(MapperBuilderAssistant.java:339)
	... 37 more


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