zoukankan      html  css  js  c++  java
  • 报错: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},希望以后不要再犯这种错误了



  • 相关阅读:
    【计算机组成原理】00-开篇词
    【设计模式】05-面向对象四大特性能解决什么问题
    【设计模式】04-面向对象谈了啥
    【设计模式】03-面向对象、设计原则、设计模式、编程规范、重构的关系
    模拟银行业务调度系统逻辑
    模拟交通灯管理系统逻辑设计
    JDK1.5新特性(七)……Annotations
    代理与动态代理
    类加载器
    JDK1.5新特性(六)……Generics
  • 原文地址:https://www.cnblogs.com/shieryuedeqiji/p/8284601.html
Copyright © 2011-2022 走看看