Mybatis出现NullPointerException的原因

org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.lang.NullPointerException
### The error may exist in xxxxxxx.xml
### The error may involve xxxxxxx.dao.xxxxxxx.findAll
### The error occurred while handling results
### SQL: select user.*,account.id as aid,account.uid,account.money from account,user where account.uid=user.id
### Cause: java.lang.NullPointerException

 

Mybatis出现NullPointerException的原因_第1张图片

                                                                         xml映射文件截图

在association标签中漏掉了javaType,导致mybatis不知道将查询出来的内容封装到哪一个类中,抛出空指针异常。添加上即可,如下图:

Mybatis出现NullPointerException的原因_第2张图片

你可能感兴趣的:(JAVA)