title: JPA OneToMany and ManyToOne throw: Repeated column in mapping for entity column (should be mapped with insert="false" update="false")
body: <p>I have three classes one of the names is User and this user has other classes instances. Like this;</p>
  <pre><code>public class User{
      @OneToMany(fetch=FetchType.LAZY, cascade = CascadeType.ALL)
      public List&lt;APost&gt; aPosts;
  
      @OneToMany(fetch=FetchType.LAZY, cascade = CascadeType.ALL)
      public List&lt;BPost&gt; bPosts;
  }
  
  
  
  
     public class BPost extends Post {
      
      @ManyToOne(fetch=FetchType.LAZY)    
      public User user;
   }
      
      public class APost extends Post {
      
       @ManyToOne(fetch=FetchType.LAZY) 
       public User user;
   }
  </code></pre>
  <p>it's working like this but generates empty tables in DB. Which have to contain foreign keys. When I tried to use <code>mappedBy</code> and <code>JoinColumn</code> annotations I got failed. How can I resolve this?</p>
  <p><strong>Extra information:</strong></p>
  <p>When I changed with;</p>
  <pre><code> @ManyToOne(fetch=FetchType.LAZY)
   @JoinColumn(name=&quot;id&quot;)
   public User user;
  </code></pre>
  <p>and</p>
  <pre><code> @OneToMany(fetch=FetchType.LAZY, cascade = CascadeType.ALL, mappedBy=&quot;id&quot;)
   public List&lt;APost&gt; aPosts;
  </code></pre>
  <p>I'm getting</p>
  <p>A JPA error occurred (Unable to build EntityManagerFactory): Repeated column in mapping for entity: models.post.APost column: id (should be mapped with insert=&quot;false&quot; update=&quot;false&quot;)</p>
  <p><strong>Final Edit:</strong> Finally, I was totally wrong about JPA annotations. :( When I change</p>
  <pre><code>@OneToMany(fetch=FetchType.LAZY, cascade = CascadeType.ALL, mappedBy=&quot;id&quot;)
  </code></pre>
  <p>to</p>
  <pre><code>@OneToMany(fetch=FetchType.LAZY, cascade = CascadeType.ALL, mappedBy=&quot;user&quot;)
  </code></pre>
  <p>and</p>
  <pre><code>@ManyToOne(fetch=FetchType.LAZY)
  @JoinColumn(name=&quot;user_id&quot;)
  </code></pre>
  <p>everything works ok. :)</p>