title: JPA - Why use @JoinColumn?
body: <p>I  am using JPA with EclipseLink (2.5.2) .</p>
  
  <p>I have the following Entities :</p>
  
  <pre><code>@Entity
  @Table(name="Consumer")
  public class Consumer implements Serializable {
  
      private static final long serialVersionUID = 1L;
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private Long id;
      private String name;
  
      @ManyToOne(cascade = CascadeType.ALL)
      @JoinColumn(name = "PRODUCER_ID")
      private Producer producer;
  
      public Consumer() {
      }
  
  
      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 Producer  getProducer() {
          return producer;
      }
  
      public void setProducer(Producer consumesFrom) {
          this.producer = consumesFrom;
      }
  
  
  
  
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>@Entity
  @Table(name="Producer")
  public class Producer implements Serializable {
  
      private static final long serialVersionUID = 1L;
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private Integer Id;
      private String dataType;
  
      private List&lt;Consumer&gt; consumers = new ArrayList&lt;&gt;();
  
  
      public Producer() {
      }
  
      public Integer getId() {
          return Id;
      }
  
      public void setId(Integer id) {
          this.Id = id;
      }
  
      public String getDataType() {
          return dataType;
      }
  
      public void setDataType(String dataType) {
          this.dataType = dataType;
      }
  
  
  }
  </code></pre>
  
  <p>And the persistence of Consumer :</p>
  
  <pre><code>   consumer.setProducer(producer); 
     entityManager.persist(consumer);
  </code></pre>
  
  <p>There is practically no difference in the expected outcome if I remove <code>@JoinColumn(name = "PRODUCER_ID")</code>.
  So I am trying to figure out what is the real usage of it.</p>
  
  <p>I have  read various examples over the Internet, I understand that it's purpose is to define the column which is used to join the two tables, but this is achieved through <code>@ManyToOne</code> already.</p>
  
  <p>So, what's the point in it?</p>