Hibernate 3.2.6 / JPA:在属性“X”中,“映射依据”属性“Y”具有此关系的无效映射类型

时间:2016-10-18 14:19:15

标签: eclipse jpa

我有这个班级

@SuppressWarnings("serial")
@Entity
@Table(name = "T_APPLICATION")
@SequenceGenerator(name = "seqAPPLICATION", sequenceName = "SEQ_APPLICATION", allocationSize = 1)

public class Application implements java.io.Serializable {

    private Set<Service> services = new HashSet<Service>(0);

    @OneToMany (fetch = FetchType.LAZY, mappedBy = "application", cascade = { CascadeType.REMOVE })
    @Cascade({ org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
    @OrderBy("id")
    public Set<Service> getServices() {
        return this.services;
    }
..
}

和另一个:

@SuppressWarnings("serial")
@Entity
@Table(name = "T_SERVICE")
@SequenceGenerator(name = "seqSERVICE", sequenceName = "SEQ_SERVICE")
public class Service extends ItemBase implements java.io.Serializable {

private Application application;

@ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "APPLICATION", nullable = false)
    public Application getApplication() {
        return this.application;
    }

    public void setApplication(Application application) {
        this.application = application;
    }
..
}

但是在我的Eclipse版本:Mars.2(4.5.2)编辑器中我有这个错误

在属性'services'中,“mapped by”属性'application'无效 此关系的映射类型。

刷新和清理我的项目没有帮助。

这是我的JPA eclipse验证器

enter image description here

0 个答案:

没有答案