Indeed, according to the Hibernate documentation on Polymorphic queries:
Hibernate queries can name any Java
class or interface in the from clause.
The query will return instances of all
persistent classes that extend that
class or implement the interface. The
following query would return all
persistent objects:
from java.lang.Object o
The interface Named might be
implemented by various persistent
classes:
from Named n, Named m where n.name = m.name
But because the interface is not mapped (and thus unknown), you need to use the fully qualified name in your HQL query:
from qualified.name.Transaction trans where trans.envelopeId=:envelopeId
This will return instances of all persistent classes that implement your Transaction
interface.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…