title: Eclipse Link to Hibernate migration error with mappedBy
body: <p>I'm trying to migrate a MySql database to Postgresql. I am using JPA and was using Eclipse Link for the MySQL database, but I am switching to Hibernate for the Postgresql database.</p>
  
  <p>The following JPA annotations work with EclipseLink:</p>
  
  <p>UserBean.java:</p>
  
  <pre><code>@OneToMany(mappedBy = "sender", cascade = CascadeType.ALL)
  @JoinTable(name = "MESSAGES_SENT")
  private List&lt;MessageBean&gt; messagesSent;
  
  @OneToMany(mappedBy = "receiver", cascade = CascadeType.ALL)
  @JoinTable(name = "MESSAGES_RECEIVED")
  private List&lt;MessageBean&gt; messagesReceived;
  </code></pre>
  
  <p>MessageBean.java:</p>
  
  <pre><code>@ManyToOne
  private UserBean sender;
  
  @ManyToOne
  private UserBean receiver;
  </code></pre>
  
  <p>With Hibernate, I get the following error message:</p>
  
  <blockquote>
    <p>org.hibernate.AnnotationException: Associations marked as mappedBy must not define database mappings like @JoinTable or @JoinColumn</p>
  </blockquote>
  
  <p>How can I get it to work with Hibernate? It is important that the database schema does not change, because I want to dump the MySql database into the Postgresql database, without modifying any tables or column names.</p>
  
  <p>Cheers,<br/>
  Dominik</p>