According to this section of the Hibernate documentation I should be able to query any java class in HQL
http://docs.jboss.org/hibernate/core/3.3/reference/en/html/queryhql.html#queryhql-polymorphism
Unfortunately when I run this query...
"from Transaction trans where trans.envelopeId=:envelopeId"
I get the message "Transaction is not mapped [from Transaction trans where trans.envelopeId=:envelopeId]".
Transaction is an interface, I have to entity classes that implement it, I want on HQL query to return a Collection of type Transaction.
Try importing the interfaces so you don't have to specify the full path. I use a file called imports.hbm.xml to handle all interfaces:
Then add that to the configuration just like a normal mapping file.
Indeed, according to the Hibernate documentation on Polymorphic queries:
But because the interface is not mapped (and thus unknown), you need to use the fully qualified name in your HQL query:
This will return instances of all persistent classes that implement your
Transaction
interface.I think you need to map the interface as the parent class and the implementing classes as its subclass.
http://docs.jboss.org/hibernate/stable/core/reference/en/html_single/#inheritance-strategies