org.apache.ibatis.builder.IncompleteElementException: Could not find result map java.lang.Long
at org.apache.ibatis.builder.MapperBuilderAssistant.getStatementResultMaps(MapperBuilderAssistant.java:346)
at org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:290)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:109)
at org.apache.ibatis.session.Configuration.buildAllStatements(Configuration.java:775)
at org.apache.ibatis.session.Configuration.hasStatement(Configuration.java:745)
at org.apache.ibatis.session.Configuration.hasStatement(Configuration.java:740)
at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:217)
at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:48)
at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:65)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
at com.sun.proxy.$Proxy97.registCount(Unknown Source)
主要原因是:
resultMap这里主要用来接收返回的字段,用于映射对象,但是现在sql返回需要一个Long对象接收(也可以使用基本数据类型long),需要把resultMap修改为resultType即可。