title: Hibernate "Could not determine type for..." ManyToOne OneToMany mapping
body: <p>I fear this is a very common problem, but I was not able to solve it anyway -.-
  I want to organize events and locations. At one location several events can be conducted.</p>
  
  <p>It boils down to these lines:</p>
  
  <p>Location:</p>
  
  <pre><code>@OneToMany(fetch = FetchType.LAZY, mappedBy="location")
  private List&lt;Event&gt; events = new ArrayList&lt;Event&gt;();
  </code></pre>
  
  <p>Event:</p>
  
  <pre><code>@ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "location_id")
  private Location location;
  </code></pre>
  
  <p>I always get this error:</p>
  
  <p>Initial SessionFactory creation failed.org.hibernate.MappingException: Could not determine type for: com.mycompany.domain.Location, at table: Event, for columns: [org.hibernate.mapping.Column(location)]</p>
  
  <p>I honestly don't see the error....
  thx in advance</p>
  
  <p>The whole code:</p>
  
  <p>Event:</p>
  
  <pre><code>package com.mycompany.domain;
  
  import java.util.ArrayList;
  import java.util.Date;
  import java.util.List;
  
  import javax.persistence.*;
  
  @Entity
  @Table
  public class Event {
  @Id
  @GeneratedValue
  private Long id;
  
  private String name;
  
  private Date date;
  
  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "location_id")
  private Location location;
  
  @OneToMany(fetch = FetchType.LAZY, mappedBy = "event")
  private List&lt;UserAttendsEvent&gt; userAttendsEvents = new ArrayList&lt;UserAttendsEvent&gt;() ;
  
  @OneToMany(fetch = FetchType.LAZY, mappedBy = "event")
  private List&lt;Invoice&gt; invoices = new ArrayList&lt;Invoice&gt;();
  
  public Long getId() {
      return id;
  }
  
  public void setId(Long id) {
      this.id = id;
  }
  
  public String getName() {
      return name;
  }
  
  public void setName(String name) {
      this.name = name;
  }
  
  public Location getLocation() {
      return location;
  }
  
  public void setLocation(Location location) {
      this.location = location;
  }
  
  public List&lt;Invoice&gt; getInvoices() {
      return invoices;
  }
  
  public void setInvoices(List&lt;Invoice&gt; invoices) {
      this.invoices = invoices;
  }
  
  public List&lt;UserAttendsEvent&gt; getUserAttendsEvents() {
      return userAttendsEvents;
  }
  
  public void setUserAttendsEvents(List&lt;UserAttendsEvent&gt; userAttendsEvents) {
      this.userAttendsEvents = userAttendsEvents;
  }
  
  public Date getDate() {
      return date;
  }
  
  public void setDate(Date date) {
      this.date = date;
  }
  }
  </code></pre>
  
  <p>Location:</p>
  
  <pre><code>package com.mycompany.domain;
  
  import java.util.ArrayList;
  import java.util.List;
  
  import javax.persistence.*;
  
  @Entity
  @Table
  public class Location {
  @Id
  @GeneratedValue
  private Long id;
  
  private String name;
  
  private String adress;
  
  @OneToMany(fetch = FetchType.LAZY, mappedBy="location")
  private List&lt;Event&gt; events = new ArrayList&lt;Event&gt;();
  
  public Long getId() {
      return id;
  }
  
  public void setId(Long id) {
      this.id = id;
  }
  
  public String getName() {
      return name;
  }
  
  public void setName(String name) {
      this.name = name;
  }
  
  public List&lt;Event&gt; getEvents() {
      return events;
  }
  
  public void setEvents(List&lt;Event&gt; events) {
      this.events = events;
  }
  
  public String getAdress() {
      return adress;
  }
  
  public void setAdress(String adress) {
      this.adress = adress;
  }
  }
  </code></pre>