Today, when you use MyBatis to execute an SQL statement, the following exception occurs:
The SQL statement configuration information executed is as follows:
<select id= "Getcolumnsbytablename" parametertype= "String" resulttype= "java.util.List" >
Select T.column_name from User_tab_columns t where T.tablename=#{tablename,jdbctype=varchar}
</select>
The corresponding DAO interface code is:
Public list<string> Getcolumnsbytablename (String tablename);
should read:
<select id= "Getcolumnsbytablename" parametertype= "string" resulttype= "string" > select T.column_name F Rom User_tab_columns t where t.tablename=#{tablename,jdbctype=varchar}</select>
The reason is that Resulttype represents the element type in the list, not the list itself, because the method declaration in DAO (marked red out)
Public list<string> getcolumnsbytablename (String tablename);
to confuse.
Remember: Resulttype returns the element type in the collection, not the collection itself