-->
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: How to mapping 2 sub table in 1 property in parent table?
PostPosted: Sat Aug 12, 2006 4:28 am 
Newbie

Joined: Sat Aug 12, 2006 4:05 am
Posts: 3
Post subject:
Hi,

I have 3 table, A, B, C
table A
id // PK
classid // discriminator, determine with sub table to use
.....

table B
id // forign key to table A id, composite PK
subid // composite PK
...

table C
id // forign key to table A id, PK
...

as the describe, the relation is
A->B one-to-many
B->A many-to-one
C<->A one-to-one

and classid in table A determine subclass in the following rule:
if classid==1 then additional information in table B
if classid==2 then additional information in table C
otherwise no additional information

and format of additional information will increased in further, means there will be table D,E,F..... for additional information.

So I want to mapping all these additional table in one property in class A. So code changes for adding table D, E, F can be limited.

<discriminator> is not the answer as it map information to many property.
<any> can map class into 1 property as type Object, but seems only satisfied one-to-one relation.

Is there any mapping method to deal with such any situation?

Thanks!


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.