Mybatismybatis查询报错org.apache.ibatis.reflection.ReflectionException: There is no getter for propert(代

Posted Angel挤一挤

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mybatismybatis查询报错org.apache.ibatis.reflection.ReflectionException: There is no getter for propert(代相关的知识,希望对你有一定的参考价值。

mybatis查询报错:

Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named areaName in class java.lang.String
    at org.apache.ibatis.reflection.Reflector.getGetInvoker(Reflector.java:419)
    at org.apache.ibatis.reflection.MetaClass.getGetInvoker(MetaClass.java:164)
    at org.apache.ibatis.reflection.wrapper.BeanWrapper.getBeanProperty(BeanWrapper.java:162)
    at org.apache.ibatis.reflection.wrapper.BeanWrapper.get(BeanWrapper.java:49)
    at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:122)
    at org.apache.ibatis.scripting.xmltags.DynamicContext$ContextMap.get(DynamicContext.java:94)
    at org.apache.ibatis.scripting.xmltags.DynamicContext$ContextAccessor.getProperty(DynamicContext.java:108)
    at org.apache.ibatis.ognl.OgnlRuntime.getProperty(OgnlRuntime.java:2685)
    at org.apache.ibatis.ognl.ASTProperty.getValueBody(ASTProperty.java:114)
    at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)
    at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:258)
    at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:470)
    at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:434)
    at org.apache.ibatis.scripting.xmltags.OgnlCache.getValue(OgnlCache.java:44)
    at org.apache.ibatis.scripting.xmltags.TextSqlNode$BindingTokenParser.handleToken(TextSqlNode.java:77)
    at org.apache.ibatis.parsing.GenericTokenParser.parse(GenericTokenParser.java:78)
    at org.apache.ibatis.scripting.xmltags.TextSqlNode.apply(TextSqlNode.java:51)
    at org.apache.ibatis.scripting.xmltags.DynamicSqlSource.getBoundSql(DynamicSqlSource.java:41)
    at org.apache.ibatis.mapping.MappedStatement.getBoundSql(MappedStatement.java:292)
    at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:81)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
    ... 66 more

 

解决方法:

需要添加

@Param("areaName")注解 标明字段
@Select("SELECT * FROM hua_yang_area WHERE area_name like %${areaName}%")
    List<HuaYangArea> selectByNameLike(@Param("areaName") String areaName);

 

以上是关于Mybatismybatis查询报错org.apache.ibatis.reflection.ReflectionException: There is no getter for propert(代的主要内容,如果未能解决你的问题,请参考以下文章

mybatismybatis访问报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)(代

mybatismybatis 查询mysql 长编码的查询使用 正向查询和反向查询

MyBatismybatis Plus 的Wrapper查询

MybatisMybatis的sql模糊查询

Mybatismybatis Example Criteria like 模糊查询

MyBatisMyBatis一级缓存和二级缓存