title: JPA EntityGraph based on meta model containing MappedSuperclass not possible?
body: <p>I'm trying to use the type safe method <code>EntityGraph.addAttributeNodes(Attribute&lt;T, ?&gt; ... attribute)</code> for constructing my entity graph. I have a type hierarchy with a <code>@MappedSuperclass</code> that basically looks like this:</p>
  
  <pre><code>@MappedSuperclass
  public abstract class BaseEntity
  {
      @Id
      private int dbid;
  }
  
  @Entity
  public class Entity extends BaseEntity
  {
      private String someAttribute;
  }
  </code></pre>
  
  <p>EclipseLink creates this meta model:</p>
  
  <pre><code>@Generated(value="EclipseLink-2.5.2.v20140319-rNA", date="2015-08-07T10:46:31")
  @StaticMetamodel(BaseEntity.class)
  public abstract class BaseEntity_ { 
      public static volatile SingularAttribute&lt;BaseEntity, Integer&gt; dbid;
  }
  
  @Generated(value="EclipseLink-2.5.2.v20140319-rNA", date="2015-08-07T10:46:31")
  @StaticMetamodel(Entity.class)
  public class Entity_ extends BaseEntity_ {
      public static volatile SingularAttribute&lt;Entity, String&gt; someAttribute;
  }
  </code></pre>
  
  <p>The problem is that I cannot refer to the <code>dbid</code> attribute with the entity graph API:</p>
  
  <pre><code>EntityGraph&lt;Entity&gt; graph = em.createEntityGraph( Entity.class );
  graph.addAttributeNodes( Entity_.dbid ); // does not compile: "The method addAttributeNodes(String...) in the type EntityGraph&lt;Entity&gt; is not applicable for the arguments (SingularAttribute&lt;BaseEntity,Integer&gt;)"
  </code></pre>
  
  <p>For this to work, wouldn't the method signature need to look like this: <code>EntityGraph.addAttributeNodes(Attribute&lt;? super T, ?&gt; ... attribute)</code>? Is this a shortcoming of the specification or am I overlooking something?</p>
  
  <p>It seems to me that this is a problem related to the one described <a href="https://stackoverflow.com/questions/13048743/jpa-static-metamodel-with-mappedsuperclass-with-a-bit-of-generation-gap-patter">here</a>. As the author of that question points out, the Criteria API <code>get</code> method for singular attributes does indeed use <code>? super X</code> to define the type parameter.</p>
  
  <p>But even when I add the <code>someAttribute</code> node, there's still this somewhat ugly warning, which I presume can only be suppressed at best:</p>
  
  <pre><code>graph.addAttributeNodes( Entity_.someAttribute ); // generates warning: "Type safety: A generic array of Attribute&lt;Entity,?&gt; is created for a varargs parameter"
  </code></pre>