Cause: org.apache.ibatis.builder.BuilderException Could not resolve type alias 'StudentIdCard'

这两天在使用mybatis框架中resultMap方法时出现的问题,困扰了我了好长时间。

错误代码如下:

Cause: org.apache.ibatis.builder.BuilderException Could not resolve type alias 'StudentIdCard'

 

Cause: org.apache.ibatis.builder.BuilderException Could not resolve type alias 'StudentIdCard'

其跟本原因就是因为resultMap中出现了问题。

错误时的StudentMapper.xml文件代码:

Cause: org.apache.ibatis.builder.BuilderException Could not resolve type alias 'StudentIdCard'

修改后的代码:

Cause: org.apache.ibatis.builder.BuilderException Could not resolve type alias 'StudentIdCard'

我的包文件

Cause: org.apache.ibatis.builder.BuilderException Could not resolve type alias 'StudentIdCard'

错误的原因就是因为此处没有写应用类所在的全路径名。如果没有声明包的路径,一定一定一定要将路径写全包名加类名

Cause: org.apache.ibatis.builder.BuilderException Could not resolve type alias 'StudentIdCard'

对于resultType也是一样的。

 

Cause: org.apache.ibatis.builder.BuilderException Could not resolve type alias 'StudentIdCard'

这里的resultMap不用修改,select中的resultMap对应的是下方resultMap中的id二者保持一致。