[jpa-spec users] JPA spec on EntityManager#createNamedQuery(String, Class)

From: Laird Nelson <>
Date: Wed, 26 Oct 2011 14:34:00 -0400

Page 72 of the JPA 2.0 specification spells out the requirements of the
EntityManager#createNamedQuery(String, Class) method:

 * Create an instance of TypedQuery for executing a
 * Java Persistence query language named query.
 * The select list of the query must contain only a single
 * item, which must be assignable to the type specified by
 * the resultClass argument.[27]

Footnote 27 reads as follows:

The semantics of this method may be extended in a future release of this
specification to support other result types. Applications that specify other
result types (e.g., Tuple.class) will not be portable.

Suppose I have an interface, A. And I have a JPA-compliant @Entity class, B,
that implements A.

Is the following construct permitted by the specification?

final TypedQuery<A> q =
em.createNamedQuery("someNamedQueryReturningBInstances", A.class);

Both EclipseLink and Hibernate accept this construction. OpenJPA rejects it

It seems to me that this is a legal construct. What say the spec authors?