title: Overriding @Id defined in a @MappedSuperclass with JPA
body: <p>I have a class AbstractEntity that is extended by all the entities in my application and basically acts as an Identifier provider.</p>
  
  <pre><code>@MappedSuperclass
  public class AbstractEntity implements DomainEntity {
  
      private static final long serialVersionUID = 1L;
  
      /** This object's id */
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      protected long id;
  
      @Temporal(TemporalType.TIMESTAMP)
      @Column(name="creation_date", nullable = false, updatable=false)
      private Date creationDate = new Date();
  
      /**
       * @return the id
       */
      public long getId() {
          return this.id;
      }
  
      /**
       * @param id the id to set
       */
      public void setId(long id) {
          this.id = id;
      }
  }
  </code></pre>
  
  <p>I have a case now where I need to define a separate Id for couple of my Entity classes as these need to have a custom Sequence Generator. How can this be achieved?  </p>
  
  <pre><code>@Entity
  @Table(name = "sample_entity")
  public class ChildEntity extends AbstractChangeableEntity {
  
      @Column(name = "batch_priority")
      private int priority;
  
      public int getPriority() {
          return priority;
      }
  
      public void setPriority(int priority) {
          this.priority = priority;
      }
  
  }
  </code></pre>