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},希望以后不要再犯这种错误了



  • 相关阅读:
    HDU 1594 find the max
    mongoose 数据库操作2
    我也来开发2048之终极奥义
    cocos2d-x 2.2.0 怎样在lua中注冊回调函数给C++
    windows常用运行命令
    机器学习——Pandas库
    搭建靶场环境
    Ubuntu快速安装MSF
    docker 基本使用
    linux下杀死进程
  • 原文地址:https://www.cnblogs.com/shieryuedeqiji/p/8284601.html
Copyright © 2011-2022 走看看