Hibernate version: 3
Name and version of the database I am using: Sybase v12.5
Due to the legacy database that I'm constraint to work with, my polymorphic association is a slight variant of what is described in
Hibernate in Action (6.4.3: Polymorphic associations and table-per-concrete-class)
Taking the example from the book, I have tables USER, CREDIT_CARD and BANK_ACCOUNT and the discriminator column BILLING_DETAILS_TYPE in the table USER.
But instead of the BILLING_DETAILS_ID column in table USER, I have columns USER_ID both in tables CREDIT_CARD and BANK_ACCOUNT which are FKs to the PK of the USER table (USER_ID).
So to implement this, it seems like I almost need a property-ref attribute in my column tag, where I can specify the name of the column in CREDIT_CARD and BANK_ACCOUNT that USER.USER_ID maps to, as in:
Code:
<any name="billingDetails" meta-type="string" id-type="long">
<meta-value value="CC" class="CreditCard"/>
<meta-value value="CA" class="BankAccount"/>
<column name="BILLING_DETAILS_TYPE"/>
<column name="USER_ID" property-ref="USER_ID"/>
</any>
Of course, the above is not supported. Is there any way to implement this mapping?
Thanks, Rishabh