mybatis fetches the problem that fields without data are not displayed
- 2021-10-27 07:28:32
- OfStack
mybatis Fields that get no data are not displayed
When using mybatis-plus to obtain data, when the return value is map type and the value of database field is null, this field will not be displayed, which will easily lead to null pointer exception when the foreground obtains data
You can set it this way
mybatis:
configuration:
call-setters-on-nulls: true
Restart the project!
mybatis Query data part field returns null
Problem description:1. There is data in the database, but it is null queried through the interface. Some fields in the same table can be queried, and some are null
Comparing the fields in database table with those in entity class, the names are all 1; Looking for information to say that resultMap is configured, and it has no effect after trying for 1 time.
Solution:The fields in the database table are spliced with _, but the definition of entity class should be named with hump, otherwise the query results will not be obtained.