You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Peter Rajsky <pe...@elline.sk> on 2003/08/01 09:59:20 UTC

1-1 association & mapping each class on a distinct table

hello,
we would like to implement following 1-1 association:
1) class A references class B [A->B]
2) class B has 2 subclasses B1 and B2. B1 and B2 are mapped on distinct
tables [t_b1 and t_b2].

3) we don't have any synthetic OID, which contains
class name - so values of our primary key attribute are not unique across
the
tables t_b1, t_b2... we can't change it now [application is deployed and
working] :(
4) (3) implies that we cannot use simple foreignkey reference descriptor,
because
we should also define, which class is referenced... so our table a should
have two columns: b_id, b_class. column b_class defines the class of
referenced
object [i know, it is not very nice from relational point of view, because
b_id
is not real foreign key...].

is it possible to implement it in OJB? [or is it stupid requirement?]

thanks a lot.

pr

note:
solution would be to create 2 subclasses of A: AreferencingB1 and
AreferencingB2 and to
map them to one table. this solution has some other problems... but we can
use it, if there
is no other solution.






---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org