title: JPA: difference between @JoinColumn and @PrimaryKeyJoinColumn?
body: <p>What's the exact difference between <code>@JoinColumn</code> and <code>@PrimaryKeyJoinColumn</code>?</p>
  
  <p>You use <code>@JoinColumn</code> for columns that are part of a foreign key. A typical column could look like (e.g. in a join table with additional attributes):</p>
  
  <pre><code>@ManyToOne
  @JoinColumn(name = "...")
  private OtherClass oc;
  </code></pre>
  
  <p>What happens if I promote the column to be a/the PK, too (a.k.a. identifying relationship)? As the column is now the PK, I must tag it with <code>@Id</code>:</p>
  
  <pre><code>@Id
  @ManyToOne
  @JoinColumn(name = "...")
  private OtherClass oc;
  </code></pre>
  
  <p>Now the question is:</p>
  
  <p>Are <code>@Id</code> + <code>@JoinColumn</code> the same as just <code>@PrimaryKeyJoinColumn</code>?:</p>
  
  <pre><code>@ManyToOne
  @PrimaryKeyJoinColumn(name = "...")
  private OtherClass oc;
  </code></pre>
  
  <p>If not, what's <code>@PrimaryKeyJoinColumn</code> there for?</p>