-->
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.  [ 3 posts ] 
Author Message
 Post subject: many to one with composite key
PostPosted: Thu Jun 03, 2010 7:57 am 
Newbie

Joined: Thu Jun 26, 2008 3:35 am
Posts: 3
I have a table named TableA wich refers to tables TableB1, TableB2, TableB3 by a composite foreign key.
These two columns are FK_B_ID and FK_Type_ID.
What I want to accomplish is to retreive EntityB1 when FK_Type_ID is 1, EntityB2 when FK_Type_ID is 2 and so on.
How would my mappings look like in order to achieve this?

thank you


Top
 Profile  
 
 Post subject: Re: many to one with composite key
PostPosted: Thu Jun 03, 2010 3:16 pm 
Newbie

Joined: Mon Feb 09, 2009 11:52 am
Posts: 11
This might help...

https://forum.hibernate.org/viewtopic.php?f=25&t=1004984&p=2431328#p2431328


Top
 Profile  
 
 Post subject: Re: many to one with composite key
PostPosted: Fri Jun 04, 2010 5:27 am 
Newbie

Joined: Thu Jun 26, 2008 3:35 am
Posts: 3
Thank you for your response. In fact I was expecting for something like this

<many-to-one name="product" class="Product" column="PRODUCT_ID">
<discriminator column="productType" discriminator-value="1"/>
/>

<many-to-one name="service" class="Service" column="PRODUCT_ID">
<discriminator column="productType" discriminator-value="2"/>
/>

is this kind of mapping possible?


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

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.