XXMapper.xml 如下:
select count(URL) TOTALCOUNT FROM TC_LOG
where RESULT=#{result}
Dao层 如下:
public int getLogCount(String result);
在调用的时候:
严重: Servlet.service() for servlet [springMVC] in context with path [/UAP] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named ‘result’ in ‘class java.lang.String’] with root cause
org.apache.ibatis.reflection.ReflectionException: There is no getter for property named ‘result’ in 'class java.lang.String’
解决:
第一种方法:发现问题出在映射文件里,如果参数使用java.lang.String的时候,需要将result改成_parameter来判断是否为空,否则它回去String这个类型里找result的getter方法,所以无法找到。
修改XXMapper.xml:
第二种方法:将result标记为mybatis可识别的标识,这样也不会去调用String这个类型里找result的getter方法。
修改Dao



