Eclipse为这种关系提供了#34;无效的映射类型" hibernate中关系的错误

时间:2015-07-09 13:33:43

标签: hibernate

我在我的两个实体之间定义了一对一的关系。 (EntHesaplasma和EntHesaplasmaek)在enthesaplasma实体中,关系注释被添加到getEntHesaplasmaek方法。

public class EntHesaplasma implements Serializable{

    @Id
    @GeneratedValue
    @Column(name = "hesaplasmaid", unique = true, nullable = false)
    public Integer getHesaplasmaid() {
       return hesaplasmaid;
    }

    ...

    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="carihareketid",insertable=false,updatable=false)
    public EntHesaplasmaek getEnthesaplasmaek() {
        return enthesaplasmaek;
    }

    public void setEnthesaplasmaek(EntHesaplasmaek enthesaplasmaek) {
        this.enthesaplasmaek = enthesaplasmaek;
    }

在另一个实体(Enthesaplasmaek类)中,关系定义如下。

public class EntHesaplasmaek implements Serializable{

     @Id
     @GeneratedValue
     @Column(name = "hesaplasmaekid", unique = true, nullable = false)
     public Integer getHesaplasmaekid() {
        return hesaplasmaekid;
     }

     ...

    @OneToOne(fetch=FetchType.LAZY,mappedBy="enthesaplasmaek")
    public EntHesaplasma getEnthesaplasma() {
        return enthesaplasma;
    }
    public void setEnthesaplasma(EntHesaplasma enthesaplasma) {
        this.enthesaplasma = enthesaplasma;
    }

但是eclipse ide会给出错误(此关系的映射类型无效),如下所示。

error

但应用程序运行没有问题。这里有什么错误吗?

0 个答案:

没有答案