title: Hibernate problem - "Use of @OneToMany or @ManyToMany targeting an unmapped class"
body: <p>I'm finding my feet with Hibernate Annotations and I've hit a problem I hope someone can help with.</p>
  
  <p>I have 2 entities, Section and ScopeTopic. The section has a List class member, so a One to Many relationship. When I run my unit test I am getting this exception:</p>
  
  <blockquote>
    <p>Use of @OneToMany or @ManyToMany targeting an unmapped class: com.xxx.domain.Section.scopeTopic[com.xxx.domain.ScopeTopic]</p>
  </blockquote>
  
  <p>I would assume that the error implies that my ScopeTopic entity isn't mapped to a table? I can't see with I have done wrong. Here are the Entity classes:</p>
  
  <hr>
  
  <pre><code>@Entity
  public class Section {
      private Long id;
      private List&lt;ScopeTopic&gt; scopeTopics;
  
      public Section() {}
  
      @Id
      public Long getId() {
          return id;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  
      @OneToMany
      @JoinTable(name = "section_scope", joinColumns = {@JoinColumn(name="section_id")},
                 inverseJoinColumns = {@JoinColumn(name="scope_topic_id")} )
      public List&lt;ScopeTopic&gt; getScopeTopic() {
          return scopeTopic;
      }
  
      public void setScopeTopic(List&lt;ScopeTopic&gt; scopeTopic) {
          this.scopeTopic = scopeTopic;
      }
  }
  </code></pre>
  
  <hr>
  
  <pre><code>@Entity
  @Table(name = "scope_topic")
  public class ScopeTopic {
      private Long id;
      private String topic;
  
      public ScopeTopic() {}
  
      @Id
      public Long getId() {
          return id;
      }
  
      public void setId() {
          this.id = id;
      }
  
      public String getTopic() {
          return topic;
      }
  
      public void setTopic(String topic) {
          this.topic = topic;
      }
  }
  </code></pre>
  
  <hr>
  
  <p>I'm pretty sure it's my own lack of understanding that's at fault so some guidance would be great, thanks!</p>