Mybatis resultMap启动时报错:Could not resolve type alias 'empno Cannot find class: empno

Po扩展类,继承用Mybatis-Gernerator工具生成的原始的Dept类,里面再包含了一个User对象

public class DeptExtends extends Dept {

//扩展类包含一个对象
public Emp emp;
public Emp getEmp() {
return emp;
}
public void setEmp(Emp emp) {
this.emp = emp;
}



DeptExtendMapper.xml


     
     
     
     
     
     
     
     
     
     
      javaType
="empno"/>    --------改成 property即可
     
     
     
     
     
     
     
     
      


错误在于上面的配置文件id写成了javaType





Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'empno'.  Cause: java.lang.ClassNotFoundException: Cannot find class: empno

at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:118)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildResultMappingFromContext(XMLMapperBuilder.java:374)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:280)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.processNestedResultMappings(XMLMapperBuilder.java:386)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildResultMappingFromContext(XMLMapperBuilder.java:366)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:280)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:252)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:244)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:116)
... 51 more
Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'empno'.  Cause: java.lang.ClassNotFoundException: Cannot find class: empno
at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:120)
at org.apache.ibatis.builder.BaseBuilder.resolveAlias(BaseBuilder.java:149)
at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:116)
... 59 more
Caused by: java.lang.ClassNotFoundException: Cannot find class: empno
at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:200)
at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:89)
at org.apache.ibatis.io.Resources.classForName(Resources.java:261)
at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:116)
... 61 more

你可能感兴趣的:(Could,not,resolve,ty,框架配置错误)