-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Polymorphic associations with dynamic classes?
PostPosted: Thu Dec 02, 2004 11:01 am 
Newbie

Joined: Thu Dec 02, 2004 10:51 am
Posts: 2
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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.