Hibernate @ManyToOne"目标实体未定义"

pat*_*029 4 java hibernate jpa-2.0

我有两个实体,当我使用@ManyToOne注释时,我收到一个错误说"Target Entity is not defined".

我只是按照教程,我似乎无法找到我做错了什么.

        @Entity
        @Table(name="BEO_TABLE")
        public class BeoBean {

            @Id
            @GeneratedValue
            @Column(name="Beo_Id")
            private int beoId;

    //other variables


            @OneToMany(mappedBy="beo")
            private List<EventsBean> listOfEvents = new ArrayList<EventsBean>();

    //getters and setters
}
Run Code Online (Sandbox Code Playgroud)

@Entity
@Table(name="EVENTS_TABLE")
public class EventsBean {

    //other variables

    @ManyToOne //error here
    @JoinColumn(name="Beo_Id")
    private BeoBean beo;

//getters and setters
}
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助

GHa*_*jba 9

此错误与您的应用程序无关.它工作正常,但错误是在Eclipse中.

要删除此(和其他JPA)错误消息,只需禁用JPA验证,Window -> Preferences -> Validation然后从中删除检查JPA Validator.

一般来说,大多数应用程序都可以在没有任何验证器的情况下开发,因为更大的项目验证会使eclipse中的编译过于缓慢.在这种情况下,请单击Disable all验证器表下方的同一窗口.