should be mapped with insert="false" update="false"

由于同一个字段注解两次就会产生这个错误,解决办法是让一个注解字段设成只读,方法和代码如下:

    @Column(name = "Entps_Code")

    public String getEntpsCode() {

        return this.entpsCode;

    }

 

    public void setEntpsCode(String entpsCode) {

        this.entpsCode = entpsCode;

    }

  

@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })

    @JoinColumn(name = "Entps_Code", insertable = false, updatable = false)

    public TbAdmDept getDeptname() {

        return deptname;

    }

     public void setDeptname(TbAdmDept deptname) {

        this.deptname = deptname;

    }

posted @ 2020-11-28 22:53  遥~  阅读(421)  评论(0编辑  收藏  举报