bug——mybatis(2)

总有一些bug,出现的让人无所适从,无从下手,查么查不出来,解么解不开,浪费时间精力,还一点毛用没有,直到怀疑人生。因此,博主把让博主深恶痛绝的bug,都给记录下来分享给大家。ps:此bug没啥高大上的,高端bug,就是一些让人烦躁的小bug

报错:

Exception in thread “main” 
org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: 
org.apache.ibatis.reflection.ReflectionException: There is no getter for property named ‘searchkey’ in ‘class java.lang.String’ ### Cause: 
org.apache.ibatis.reflection.ReflectionException: There is no getter for property named ‘searchkey’ in ‘class java.lang.String’
 

解决方式:

https://blog.csdn.net/soonfly/article/details/63385018

如果只有一个参数,参数又在if标签中,那么

解决办法就是用_parameter替换searchkey

或者在接口的方法参数前加上param注解

public List<User> findByName(@Param(value="searchkey") String searchkey) throws Exception;
 

猜你喜欢

转载自blog.csdn.net/qq_42683700/article/details/84580167