Hibernate version: 3.0 alpha
Reading through the Hibernate in Action book, I can across this example in section 6.4.3:
There was a user class/table and two associations a credit card, and a bank account. Depending on the discriminator in the user class (billing_details_type), it associated with either the credit card class or the bank account class. I have a similar schema but I have maybe 50 or so tables that will be associated (only one at a time). The problem is that I don't know all the tables in advance. But I thought I could with 3.0, build <dynamic-class>'s of all the tables and then use an <any> tag like the book example:
<any name="billingDetails" meta-type="string" id-type="long"
cascade="save-update">
<meta-value value="CC" class="CreditCard"/>
<meta-value value="CA" class="BankAccount"/>
<column name="BILLING_DETAILS_TYPE"/>
<column name="BILLING_DETAILS_ID"/>
</any>
My question is two-fold: can this be done with dynamic-classes? and as far as the book example goes, what would the BillingDetails class look like; that is what would the getter method return for this <any> type?
|