Hibernate-映射问题

Hibernate-映射问题,hibernate,Hibernate,我遇到了一个hibernate映射的问题 我的数据库设计成一对多 一个课程/教师/学生,可以有多个寄存器 几乎所有实体类都是相同的关系, 因此,如果我们以学生为例,这将是我的映射 import java.util.List; import javax.persistence.*; @Entity //here you define your class as entity which means is connected to the database @Table(name="stud

我遇到了一个hibernate映射的问题

我的数据库设计成一对多

一个课程/教师/学生,可以有多个寄存器

几乎所有实体类都是相同的关系,

因此,如果我们以学生为例,这将是我的映射

import java.util.List;
import javax.persistence.*;


@Entity //here you define your class as entity which means is connected to the database 
@Table(name="students") //here you are referring the SQL table 

public class Student {
    @Id //to define it is a primary key
    @Column(name="student_id")  // name must be exact as the column in SQL
    private String studentID;

    @Column(name="first_name")
    private String firstName;

    @Column(name="last_name")
    private String lastName; 

    @Column(name="date_of_birth")
    private String dateOfBirth;

    @Column(name="email")
    private String email;

    //Establishing Mapping 

    @OneToMany(mappedBy="student_id",
               cascade=CascadeType.ALL,targetEntity = Student.class, fetch = FetchType.LAZY)
     List <Register> registers;
我的输出是:

Exception in thread "AWT-EventQueue-0" org.hibernate.AnnotationException: @OneToOne or @ManyToOne on model.Register.course references an unknown entity: model.Course
    at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:97)

非常感谢您提供的任何帮助。

关于
model.Course
,您有这个实体吗?检查学生和老师的targetEntity=Course.class。我认为应该是学生的班级,学生的班级,老师的班级
Exception in thread "AWT-EventQueue-0" org.hibernate.AnnotationException: @OneToOne or @ManyToOne on model.Register.course references an unknown entity: model.Course
    at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:97)