Hibernation display - "Failed to determine type"

Currently, I am successfully saving the following objects:

  • Face name etc.
  • Exams , date, etc.

I would like to create a third table Exam Results . For this table, I believe that it should be an identity identifier, an exam identifier and a result, and this relationship is many, many.

@Entity
public class ExamResult {
    private Exam exam;
    private Person person;
    private double value;

    @Id
    @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )
    @JoinColumn(name="EXAM_ID")
    public Exam getExam() {
        return exam;
    }
    public void setExam(Exam exam) {
        this.exam = exam;
    }

    @Id
    @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )
    @JoinColumn(name="PERSON_ID")
    public Person getPerson() {
        return person;
    }
    public void setPerson(Person person) {
        this.person = person;
    }

    public double getValue() {
        return value;
    }
    public void setValue(double value) {
        this.value = value;
    }
}

Error:

org.hibernate.MappingException: could not determine the type for: Person, at table: ExamResult, for columns: [org.hibernate.mapping.Column (person)]

I think that maybe I'm wrong, but I can’t figure out how to continue this relationship with the tutorial .

Any ideas?

+5
1

@Id . . .

+11

All Articles