Welcome to my website, have a nice day!
Dream it, Do it, Make it!

Mybatis There is no getter for property 解决

mybatis查询出错:

nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'tableName' in 'class java.lang.String'

出错原因

具体涉及代码:

mapper.xml

 <!--检查表是否存在-->
<select id="checkIsTableExists" parameterType="String" resultType="Integer">
     SELECT COUNT(*) as "countNum"
      FROM USER_TABLES
     WHERE TABLE_NAME = ${tableName}
 </select>

Mapper类

/**
 * 检查表是否存在
 *
 * @param tableName 表名
 * @return 数量
 */
Integer checkIsTableExists(String tableName);

解决办法

修改代码:

/**
 * 检查表是否存在
 *
 * @param tableName 表名
 * @return 数量
 */
Integer checkIsTableExists(@Param(value = "tableName") String tableName);

参考:

  1. 解决There is no getter for property named in class java.lang.String
赞(0)
未经允许禁止转载:Ddmit » Mybatis There is no getter for property 解决

评论 抢沙发

登录

找回密码

注册