• 报错:There is no getter for property named 'customer' in 'class cn.huanhuanjun.estore.bean.Customer



    eclipse报错There is no getter for property named 'customer' in 'class cn.huanhuanjun.estore.bean.Customer'
    org.apache.ibatis.exceptions.PersistenceException: ### Error updating database. Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'customer' in 'class cn.huanhuanjun.estore.bean.Customer' ### Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'customer' in 'class cn.huanhuanjun.estore.bean.Customer' org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:172) org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:55) org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53) com.sun.proxy.$Proxy8.updateCustomer(Unknown Source) cn.huanhuanjun.estore.service.ICustomerServiceImpl.updateCustomer(ICustomerServiceImpl.java:39) cn.huanhuanjun.estore.web.servlet.UpdateCustomerInfoServlet.doGet(UpdateCustomerInfoServlet.java:44) cn.huanhuanjun.estore.web.servlet.UpdateCustomerInfoServlet.doPost(UpdateCustomerInfoServlet.java:54) javax.servlet.http.HttpServlet.service(HttpServlet.java:647) javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

    查了一下

      网友博客http://blog.csdn.net/xu_xuan/article/details/43562167上解释的原因是DAO方法中定义的参数与实体中定义的属性不一致导致的。

        解决方案:

            dao层加@Param("userId")注解即可

            public List<DictItem> selectKeyByUserId(@Param("xxx") long xxx);

    我检查了一下我自己的代码,发现我的错误是SQL语句中将#{xxx}写成了${xxx},希望以后不要再犯这种错误了



  • 相关阅读:
    luogu P3368 【模板】树状数组 2
    dp
    vijos 羽毛
    luogu tyvj 纪念品分组
    codevs 1259 最大正方形子矩阵 WD
    python 序列化之pickle模块 json模块
    python 类的进阶
    python 面向对象与类的基本知识
    python 异常处理
    python time模块 sys模块 collections模块 random模块 os模块 序列化 datetime模块
  • 原文地址:https://www.cnblogs.com/shieryuedeqiji/p/8284601.html
Copyright © 2020-2023  润新知