-->
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: one-to-many + inheritance + many-to-one + inheritance
PostPosted: Tue Feb 01, 2005 2:38 pm 
Newbie

Joined: Tue Feb 01, 2005 1:57 pm
Posts: 1
Case:

Classes:
Class C(pk);
Class RA(), RB(), RC() extends R()
Class PA(), PB extends P(pk);

C (1)----(n) R (n)----(1) P

DB model:

C_TABLE (ID, ... , primary key(ID));

R_TABLE (C_FK, P_FK, R_CODE, primary key(C_FK, P_FK, R_CODE));
C_FK foreing key to C_TABLE.ID
P_FK foreing key to P_TABLE.ID

P_TABLE (ID, primary key(ID));

PA_TABLE (ID, ..., primary key(ID));
ID foreing key to P_TABLE.ID

PB_TABLE (ID, ..., primary key(ID));
ID foreing key to P_TABLE.ID


Navigation:

from C get all Rs and for one R get the P
from Rs get C or P
from Ps get all Rs and for one R get the C

Mapping:

- imagined:
class C mapped on C_TABLE
classes RA, RB, RC, R mapped using Table Per Class Hierarchy strategy on R_TABLE
classes PA, PB, P mapped using Table Per SubClass strategy on PA/PB/P_TABLE


Problem:
The problem comes when trying to define the mapping for RA, RB, RC, R!
In the given context I'm not able to define a correct mapping for hibernate, specially
when trying to define the <id> or <composite-id> for R (with RA, RB, RC subclasses) mapping.

Is it possible for the given DB model to have an Inheritance mapping for R, RA, RB, RC on the R_TABLE ?

The main Constraint is the DB model.
Would be any solution with minimum modification on the DB?

Should I use a different mapping that the imagined one?


thx a lot,
tudors.


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.