title: How does Hibernate Search handle annotations inherited from a superclass?
body: <p>I'm having trouble creating a proper index structure with these entities:</p>
  
  <p><strong>Person</strong></p>
  
  <pre><code>@Entity
  public class Person implements Serializable {
      @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
      private Long id;
  
      @OneToMany(mappedBy = "person")
      @ContainedIn
      private Set&lt;PersonRole&gt; roles = new LinkedHashSet&lt;&gt;();
  
      @Field 
      private String firstname;
  
      // other properties, getter + setter
  }
  </code></pre>
  
  <p><strong>PersonRole</strong></p>
  
  <pre><code>@Entity
  @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
  public abstract class PersonRole implements Serializable {
  
      @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "personrolegen")
      @SequenceGenerator(name = "personrolegen", sequenceName = "person_role_id_seq")
      protected Long id;
  
      @MapsId
      @ManyToOne(optional = false, cascade = { CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE })
      @IndexedEmbedded(depth = 4)
      protected Person person;
  }
  </code></pre>
  
  <p><strong>Talent</strong></p>
  
  <pre><code>@Entity
  @Indexed
  public class Talent extends PersonRole implements Serializable {
      @Field
      private String email;
  }
  </code></pre>
  
  <p>In this model, a <code>Person</code> may have one or more <code>PersonRole</code>s. Historically the index has been the other way around, ie starting from <code>Talent</code> and including <code>Person</code>. However, when I deployed and saved a few <code>Talent</code> instances, looking at the index there's no <code>person.firstname</code> (or any person property) in talent's index.</p>
  
  <p>I also tried working the other way around, switching <code>@ContainedIn</code> and <code>@IndexedEmbedded</code>, thus including <code>Talent</code> in <code>Person</code>'s index, but that didn't work either - no <code>talent.email</code> in my person index.</p>
  
  <p>I prefer the historical structure but if somebody can point out a way to make the other direction work more easily that's welcome as well.</p>
  
  <p>Sanne <a href="https://forum.hibernate.org/viewtopic.php?p=2435287#p2435287" rel="nofollow">pointed out</a> that a similar problem might only be solveable via a custom FieldBridge but Hibernate's JIRA is down for me and I've no idea how I'd go about indexing the properties of <code>Talent</code> here (there're way more than the one shown here, including several <code>@IndexedEmbedded</code>). So if anybody could throw me a link explaining that, I'd be happy to accept this as well.</p>