title: How to create an index with JPA/hibernate and use fields from MappedSuperClass together with fields from concrete entity
body: <p>I have the <code>@MappedSuperClass</code> (simplified example):</p>
  
  <pre><code>@MappedSuperclass
  public abstract class MySuperClass {
  
      @Id
      @GeneratedValue
      private long id;
  
      @Column(nullable = false)
      private Date creationDate;
  
      // ...
  }
  </code></pre>
  
  <p>and a concrete <code>Entity</code> (simplified example):</p>
  
  <pre><code>@Entity
  public class MyEntity extends MySuperClass {
      @Index(name = "IDX_MYINDEX")
      @Column(nullable = false)
      @Enumerated(EnumType.STRING)
      private MyType type;
  
      @Index(name = "IDX_MYINDEX")
      @Column(nullable = false)
      @Enumerated(EnumType.STRING)
      private MyResult status;
  
      // ...
  }
  </code></pre>
  
  <p>Now I need an index including the columns <code>MySuperClass.creationDate</code>, <code>MyEntity.status</code> and <code>MyEntity.type</code>. </p>
  
  <p>If I add <code>@Index(name = "IDX_MYINDEX")</code> to <code>MySuperClass.creationDate</code> hibernate adds an index of <code>creationDate</code> to every Entity inherited from <code>MySuperClass</code>.</p>
  
  <p>I tried <code>@AttributeOverride</code> but it is not capable for indexes.</p>
  
  <p>Any ideas?</p>