1. Problem Description
After configuring select in the xml configuration file of mybatis, the query reports an error:
Result type not match... or
< p> Result Maps collection does not contain value for java.lang.String orCould not find result map java.lang.String and other exceptions.
2. Cause of the problem
1. If the return value in the dao.xml file is defined as resultType="java.util.List", the dao layer will report an error, prompting Result type not match...;
2. The resultMap in the .xml file is set to the basic data type (String, Integer, Double, etc.), for example: resultMap="java.lang.String"
3. Solution
Just change resultMap="java.lang.String" to resultType="java.lang.String".
For the difference between them, please view the following article:
The difference between resultType and resultMap in Mybatis