You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Armin Waibel <ar...@apache.org> on 2004/07/04 02:28:42 UTC
[OJB275] Problem with inheritance mapped on multiple tables
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
Re: [OJB275] Problem with inheritance mapped on multiple tables
Posted by Armin Waibel <ar...@apache.org>.
Jakob Braeuchi wrote:
> hi armin,
>
> could you please post your patch to AnonymousPersistentFieldHelper. i
> still get unique-key violations ?
>
I checked in my changes.
regards,
Armin
> jakob
>
> Armin Waibel wrote:
>
>> 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
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org
Re: [OJB275] Problem with inheritance mapped on multiple tables
Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi armin,
could you please post your patch to AnonymousPersistentFieldHelper. i still get
unique-key violations ?
jakob
Armin Waibel wrote:
> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org