How to perform a non-polymorphic HQL query in Hibernate?

Use polymorphism="explicit" in the class mapping. This will cause queries to return only instances of the named class and not its subclasses.

Implicit polymorphism means that
instances of the class will be
returned by a query that names any
superclass or implemented interface or
class, and that instances of any
subclass of the class will be returned
by a query that names the class
itself. Explicit polymorphism means
that class instances will be returned
only by queries that explicitly name
that class.

Leave a Comment