title: "mappedBy reference an unknown target entity property" using Hibernate
body: <p>I am using Hibernate for the first time and am having trouble getting it to work with my schema.</p>
  
  <p>I am getting "<em>org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: Student.Faculty in Faculty.allStudents</em>".</p>
  
  <p>Some students share a single mentor. I would think the student relation to faculty would be ManyToOne because of this, but I was told it is a OneToOne relation.</p>
  
  <p>Student.java</p>
  
  <pre><code>import javax.persistence.*;
  
  @Entity  
  @Table(name = "Student")  
  @PrimaryKeyJoinColumn(name="StudentID")
  public class Student extends Person
  {
      @Column(name = "Classification")  
      private String Classification;
  
      @Column(name = "GPA")
      private double GPA;
  
      @OneToOne(mappedBy="Student")
      @JoinColumn(name = "FacultyID")
      private Faculty Mentor;
  
      @Column(name = "CreditHours")
      private int CreditHours;
  
      public Student()
      {
  
      }
      public Student(String studentID, String classification, double gpa, String mentorID, int creditHours)
      {
          //this.StudentID = studentID;
          this.Classification = classification;
          this.GPA = gpa;
          //this.MentorID = mentorID;
          this.CreditHours = creditHours;
      }
      public String getClassification()
      {
          return Classification;
      }
      public void setClassification(String classification)
      {
          this.Classification = classification;
      }
      public double getGPA()
      {
          return GPA;
      }
      public void setGPA(int gpa)
      {
          this.GPA = gpa;
      }
      public Faculty getMentor()
      {
          return Mentor;
      }
      public void setMentor(Faculty mentor)
      {
          this.Mentor = mentor;
      }
      public int getCreditHours()
      {
          return CreditHours;
      }
      public void setCreditHours(int creditHours)
      {
          this.CreditHours = creditHours;
      }
  }
  </code></pre>
  
  <p>Faculty.java</p>
  
  <pre><code>import javax.persistence.*;
  import java.util.Set;
  
  @Entity  
  @Table(name = "Faculty")  
  @PrimaryKeyJoinColumn(name="FacultyID")
  public class Faculty extends Person
  {
      @Column(name = "Rank")  
      private String Rank;
      @Column(name = "Salary")
      private int Salary;
  
      @OneToMany(mappedBy="Faculty")
      private Set&lt;Student&gt; allStudents;
  
      public Faculty()
      {
  
      }
      public Faculty(String facultyID, String rank, int salary)
      {
          //this.FacultyID = facultyID;
          this.Rank = rank;
          this.Salary = salary;
      }
      public String getRank()
      {
          return Rank;
      }
      public void setName(String rank)
      {
          this.Rank = rank;
      }
      public int getSalary()
      {
          return Salary;
      }
      public void setSalary(int salary)
      {
          this.Salary = salary;
      }
  
      public Set&lt;Student&gt; getAllStudents()
      {
          return allStudents;
      }
      public void setAllStudents(Set&lt;Student&gt; allStuds)
      {
          this.allStudents = allStuds;
      }
  }
  </code></pre>
  
  <p>Database schema:</p>
  
  <pre><code>CREATE TABLE Person (
  Name    char (20),
  ID      char (9) NOT NULL,
  Address char (30),
  DOB     date,
  PRIMARY KEY (ID));
  
  CREATE TABLE Faculty (
  FacultyID       char (9) NOT NULL,
  Rank            char (12),
  Salary          int,
  PRIMARY KEY (FacultyID),
  FOREIGN KEY (FacultyID) REFERENCES Person(ID));
  
  CREATE TABLE Student (
  StudentID       char (9) NOT NULL,
  Classification  char (10),
  GPA             double,
  MentorID        char (9),
  CreditHours     int,
  PRIMARY KEY (StudentID),
  FOREIGN KEY (StudentID) REFERENCES Person(ID),
  FOREIGN KEY (MentorID) REFERENCES Faculty(FacultyID));
  </code></pre>
  
  <p>I have tried several different annotations after looking at documentation but I don't see what I am doing wrong.</p>