mybatis中Caused by: org.apache.ibatis.reflection.ReflectionException

Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'userId' in 'class java.lang.Long'
    at org.apache.ibatis.reflection.Reflector.getGetInvoker(Reflector.java:380)
    at org.apache.ibatis.reflection.MetaClass.getGetInvoker(MetaClass.java:170)...

项目中有一个模糊查询,xml文件是这么写的

结果不管我怎么改resultType和parameterType都没用,还用了resultMap,也没用,最后,网上查到这么一个方法,在dao层中加,@Param("bookWriter")

这才解决了问题。

另外,我跟之前的对比了一下,

发现,不用模糊查询,那么就算不加@Param,也能正常查询,并且不报错。

猜你喜欢

转载自my.oschina.net/u/3442347/blog/1797247