org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'id' in 'cla

org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'id' in 'class com.wqm.step.pojo.UUser'
at org.apache.ibatis.reflection.Reflector.getSetInvoker(Reflector.java:372)
at org.apache.ibatis.reflection.MetaClass.getSetInvoker(MetaClass.java:174)
at org.apache.ibatis.reflection.wrapper.BeanWrapper.setBeanProperty(BeanWrapper.java:167)
at org.apache.ibatis.reflection.wrapper.BeanWrapper.set(BeanWrapper.java:57)

at org.apache.ibatis.reflection.MetaObject.setValue(MetaObject.java:133)


针对于这个问题,我已经找到了解决方案

    我们看一下mapper.xml文件:

            
"id" column="uid" />


"id" column="oid" />


        

再看一下我的实体类:

        public class UUser {
    private Integer uid;
    private String uname;
    
    private List orders;
    public List getOrders() {
  return orders;

  }

  public void setOrders(List orders) {
  this.orders = orders;
  }
  public Integer getUid() {
        return uid;
    }
    public void setUid(Integer uid) {
        this.uid = uid;

    }

网上看了很多种说法,但是最后大家都没有给出好的解释!!!!!

我标记的第一个id,其实是对应实体类中的id,但是实体类中是uid,所以mappe.xml文件中的id改为uid就可以了。

也就是说,property属性后面一定要与实体类中定义的属性一致,就可以了。

你可能感兴趣的:(org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'id' in 'cla)