org.hibernate.NonUniqueObjectException: a different object with the same ide

来源:互联网 发布:怎么在淘宝上买发票 编辑:程序博客网 时间:2024/05/18 00:05
org.hibernate.NonUniqueObjectException: a different object with the same ide出现这种情况一般是一对多或者多对多级联方面,我的情况是两边同时级联 把关联表的留下,外界表的去除即可    @OneToMany(mappedBy="admin")//,cascade=CascadeType.ALL)//,fetch=FetchType.EAGER)    public Set<AdminRole> getAdminroles() {        return adminroles;    }    @ManyToOne(cascade=CascadeType.ALL)//,fetch=FetchType.EAGER)    @JoinColumn(name="adminId")    public Admin getAdmin() {        return admin;    }


原创粉丝点击