Consider the following example of 'table per subclass' inheritance mapping:
Code:
<class name="Payment" table="PAYMENT">
<id name="id" type="long" column="PAYMENT_ID">
<generator class="native"/>
</id>
<property name="amount" column="AMOUNT"/>
...
<joined-subclass name="CreditCardPayment" table="CREDIT_PAYMENT">
<key column="PAYMENT_ID"/>
...
</joined-subclass>
<joined-subclass name="CashPayment" table="CASH_PAYMENT">
<key column="PAYMENT_ID"/>
...
</joined-subclass>
<joined-subclass name="ChequePayment" table="CHEQUE_PAYMENT">
<key column="PAYMENT_ID"/>
...
</joined-subclass>
</class>
If the classes 'CashPayment' and 'ChequePayment' implement the
interface 'NonelectronicPayment' (which is not described anywhere in the mapping) will hibernate support queries of the form:
"from NonelectronicPayment np where np.id = 1234" (where 1234 is the id of the Payment that must be retrieved)
Also if this query is supported will the returned object still be of type 'CashPayment' (or 'ChequePayment' )?
Is support for this behaviour via 'implicit polymorphism'? If so which versions of hibernate support 'implicit polymorphism'?