About the error querying database. Cause: java.lang.nullpointerexception reported in mybatis

There is such a problem when upgrading the previous project today

### Error querying database.  Cause: java.lang.NullPointerException
### The error may exist in file [/Users/xxxx/IDEA-Pr/Hire/UserInformation/target/classes/mapper/EmployeeDao.xml]
### The error may involve com.app.hire.dao.EmployeeDao.selectEmployee
### The error occurred while handling results
### SQL: select         e.user_id,         e.name,         e.age,         e.sex,         e.employee_desc,         e.create_time,         e.last_edit_time,         e.phone,         e.address,         e.image,         a.area_id,         a.area_name,         a.area_desc         from tb_area a,tb_employee e         where a.area_id=e.area_id and e.user_id=?
### Cause: java.lang.NullPointerException] with root cause

The wrong information as like as two peas in the mapper file, I ran the code that didn’t upgrade. The result is the same code. It can’t be used here. The springboot version of the previous code is 2.3.7.RELEASE. The current version is 2.2.2.RELEASE
after two hours of crazy inquiries. Finally, the problem is found
in our mapper file, if you want to perform a joint query, you will write a resultmap to put the query results. The class to be jointly queried has an attribute javatype. Set the real class of the object as shown in the figure below


but it is strange that my previous version can run without this javatype, As a result, the version has been reduced, but it can’t run. Do you have a boss to help answer the reason?Is it because the springboot version has been upgraded?

Conclusion: when writing resulmap, you’d better add javatype, otherwise there’s no place to find such errors.


Read More: