Queries are polymorphic in standard JPA. Here are the relevant sections from the JPA 1.0 Specification:
3.6.5 Polymorphic Queries
By default, all queries are
polymorphic. That is, the FROM clause
of a query designates not only
instances of the specific entity
class(es) to which it explicitly
refers, but subclasses as well. The
instances returned by a query include
instances of the subclasses that
satisfy the query conditions.
For example, the query
select avg(e.salary) from Employee e where e.salary > 80000
returns the average salary of all
employees, including subtypes of
Employee
, such as Manager
and
Exempt
.
And
4.4.8 Polymorphism
Java Persistence queries are
automatically polymorphic. The FROM
clause of a query designates not only
instances of the specific entity
class(es) to which explicitly refers
but of subclasses as well. The
instances returned by a query include
instances of the subclasses that
satisfy the query criteria.
So any query on a supertype will include subtypes in the results by default.