title: Hibernate / JPA: Is it possible to Override @Id field?
body: <p>Is there a method to reassign the <code>@Id</code> in child entity after it was assigned to some field in the parent entity</p>
  
  <p>For example:</p>
  
  <pre><code>@MappedSuperclass
  @Access(AccessType.FIELD)
  public abstract class Parent implements Serializable {
  
    @Id
    protected Integer parentId;
  
    public Integer getId() {
      return parentId;
    }
  
    public void setId(Integer id) {
      this.id = parentId;
    }
  }
  
  
  @Entity
  @Access(AccessType.FIELD)
  public class Child extends Parent implements Serializable {
  
    /*
     What should be added to this entity to re assign the @Id to a new field and 
     make the parentId field just an ordianry field in the Child, not the entity Id
    */
    @Id
    private Long childId;
  
  }
  </code></pre>
  
  <p>I have tried to use <a href="http://docs.oracle.com/javaee/6/api/javax/persistence/AttributeOverride.html" rel="nofollow"><code>@AttributeOverride</code></a>, but all it could provide is to rename the id column name.</p>