【Mybatis】mybatis查詢報錯org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'areaName' in 'class java.lang.String'

來源:互聯網
上載者:User

標籤:bind   java   body   tsql   ...   scripting   ssi   for   statement   

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);

 

【Mybatis】mybatis查詢報錯org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'areaName' in 'class java.lang.String'

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.