I'm using Hibernate 3.1 beta 3.
I need to map a polymorphic association very much like the table-per-concrete class Payment example in Chapter 8 of the Hibernate Reference Documentation.
The end result would be a
Code:
Payment payment = getPayment();
method that would return an instance of one of the concrete subclasses of Payment.
Using a mapping document I would use the <any> element. From the reference:
Code:
<any name="payment" meta-type="string" id-type="long">
<meta-value value="CREDIT" class="CreditCardPayment"/>
<meta-value value="CASH" class="CashPayment"/>
<meta-value value="CHEQUE" class="ChequePayment"/>
<column name="PAYMENT_CLASS"/>
<column name="PAYMENT_ID"/>
</any>
Can you do this using annotations? What annotations would you use?
Thanks