Hi all,

I have a class A referencing another class B. My code (and database) works 
fine for a long time but now I have to do some major changes to my app: class 
A must reference class B OR class C. These two classes should share the same 
interface (or inherit from the same abstract class) but must be stored in 
distinct tables (ie. table per class).

There's no pb with OJB, I'm going to just use <extent-class> in my 
<class-descriptor> for the class A.

But what about the database and its referential integrity? Since I map each 
class of the hierarchy to distinct table there is a pb with database because 
as far as I know standard SQL foreign keys refers to only one table.

Hmm I gess it's a common and very basic question.. But what should I do if I 
want to not lose database referential integrity (ie. removing FK constraint)?

Mapping B and C class to the same table is the only solution? I guess not..
Maybe I should add anoter FK from my table A to table C and then add 
getters/setters to class A relating to the interface: the getter would return 
a class B or C, and the setter would add a class B or C (in condition that 
neither is already linked).

Thanks a lot for your good advices,

Regards,

Vincent.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to