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:
- How to Solve mybatis returns null when querying Oracle database with char type field
- Error reporting: java.lang.nullpointerexception solution
- Error querying database. Cause: java.util.ConcurrentModificationException
- Android studio — java.lang.nullpointerexception(no error message)
- Error querying database.Cause:java.sql.SQLSyntaxErrorException:ORA-00911:invalid character
- The @ Autowired annotation in springboot is invalid in ordinary classes. How to solve and use the null pointer exception java.lang.nullpointerexception
- Idea community version starts Tomcat to report error running ‘XXXXXX’: java.lang.NullPointerException
- Method threw ‘java.lang.NullPointerException‘ exception. Cannot evaluate com.sun.proxy.xxx
- Mybatis error,There is no getter for property named ‘xx’ in ‘class java.lang.String The solution
- Error in idea compilation: java.lang.OutOfMemoryError Java heap space and java.lang.StackOverflowError
- Pychar console error: xmlrpc.client.Fault : Fault 0: ‘ java.lang.NullPointerException
- The java.lang.exceptionininitializererror of mybatis reports an error
- Eclipse:An error has occurred. See error log for more details. java.lang.NullPointerException
- When the mybatis field contains an expression, an error is reported when it is stored in the database
- Mybatis exception error setting driver on unpoleddatasource. Cause: java.lang.ClassNotFoundException :
- Mybatis database error java.sql.SQLException : Error setting driver on UnpooledDataSource. Caus
- A problem occurred configuring project ‘:x x x‘. > java.lang.NullPointerException (no error message)
- Errorjava.lang.NullPointerException(no error message)
- The springboot test class reported an error NullPointerException
- java.lang.ClassNotFoundException : com.mysql.jdbc . driver project cannot connect to database, exception, lack of MySQL driver