-->
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: Variant of polymorphic assoc. w/ table-per-concrete-class
PostPosted: Wed May 25, 2005 2:52 pm 
Newbie

Joined: Tue Apr 19, 2005 4:32 pm
Posts: 14
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


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.