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!
|