db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Armin Waibel <arm...@apache.org>
Subject [OJB275] Problem with inheritance mapped on multiple tables
Date Sun, 04 Jul 2004 00:28:42 GMT
Hi all,

in AnonymousPersistentFieldHelper the class hierarchy of all super 
classes was created for all classes mapped to multiple tables. All 
fields from the sub-class are copied to the super class, except the PK 
fields. This cause problems.
I update the tests to reproduce the problems of OJB275 (by Michael 
Rosenberger). This cause all ten tests to fail, because the test now use 
a composite PK (autoincrement / non-autoincrement PK) and the 
non-autotincrement PK of the super classes will never be set.

E.g.
Employee <--- Executive <--- Manager

Assume we want to store a Manager object and we use multi mapped 
inheritance, OJB will create a temporary Executive and a temporary 
Employee object and then store all objects. Currently the PK values are 
not passed to the super classes, thus temporary objects don't have valid 
PK values. If an auto-increment PK was used a new PK was created, 
non-autoincrement PK are never set ---> failures in tests.

If we pass the PK values of the sub-class to the super classes all tests 
will pass (except the odmg-api, but these failures will be caused by 
odmg impl). If we store an Manager object with non-autoincrement id 21, 
a Manager[21] an Executive[21] and Employee[21] will be stored to tables 
MANAGER, EXECUTIVE, EMPLOYEE.
Inheritance don't need extent aware PK values (uniqueness of PK across 
all involved tables).

Any comments? side-effects when include PK values?
If you agree I will patch AnonymousPersistentFieldHelper (and patch 
sequence manager too - needs tweak to support key generation of copied 
PK values).


regards,
Armin

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


Mime
View raw message