title: Use @NamedEntityGraph on attribute from @MappedSuperclass
body: <p>I tried many different things and did loads of research, yet still fail to get the following working: I want to define an <code>@NamedEntityGraph</code> on an entity, but the attribute I refer to is located in the parent class, which is defined with <code>@MappedSuperclass</code>.</p>
  
  <p>I have the slight feeling (also after checking the code how the entity graphs are built) that this does not work, but maybe someone can shed some light on it.</p>
  
  <p>Here's in detail what we are trying to to (some things shortened):</p>
  
  <pre><code>@MappedSuperclass
  public class UserBase {
    private Long id;
    private String loginname;
    private String password;
  
    @ManyToMany(fetch = FetchType.LAZY)
    private Set&lt;Role&gt; roles;
    ....
  }
  </code></pre>
  
  <p>And the actual entity:</p>
  
  <pre><code>@Entity
  @NamedEntityGraph(
    name = "withRoles",
    attributeNodes = { @NamedAttributeNode("roles") })
  public class User extends UserBase {
     ....
  }
  </code></pre>
  
  <p>What happens is, that we get the error</p>
  
  <pre><code>Unable to locate Attribute with the the given name [roles] on this ManagedType [some.package.path.User]
  </code></pre>
  
  <p>Stepping through the graph creation code I can see that it only looks at the attributes defined on the class itself, none from the supertype. Any chance I can define the graph in such a way, that this works?</p>
  
  <p>Thanks for any hints!</p>