hi saleem,

may be it was too late yesterday... of course it must be caused by multi-table-inheritance somehow, because my test-case works.

sorry
jakob

Jakob Braeuchi schrieb:

hi saleem,

Saleem Shafi schrieb:

To be perfectly honest, i'm not 100% sure this problem is restricted
to inheritance over multiple tables, but that's the configuration i'm
running into the problem with.


imo this is not a problem caused by multi-table-inheritance. i'm currently working on a testcase using bidirectional references in class ReferenceTest.

        RefObject a = new ObjA();
        RefObject b = new ObjB();

        b.setName(name+"_second_1");
        a.setName(name+"_first_1");

        a.setRef(b);
        b.setRef(a);

        broker.beginTransaction();
        broker.store(a);
        broker.commitTransaction();

so far i cannot confirm an issue with inserting an object twice (i use no multi-table-inheritance) :

INSERT INTO REF_OBJ_B (OBJ_ID,NAME,FK_REF) VALUES ('47','testStoreBidirectionalReference_1096487333296_second_1','46')
INSERT INTO REF_OBJ_A (OBJ_ID,NAME,FK_REF) VALUES ('46','testStoreBidirectionalReference_1096487333296_first_1','47')


but i also have to admit, that there are no foreign key constraints.

btw what version are you using ?

jakob


Here's the setup: i've got a base class (Role) and a subclass (Faculty). There's a ROLE table and a FACULTY table and it's mapped according to the description of option #3 in the guide. Role defines a 1-to-1 relationship with Person and there's a column in the ROLE table that corresponds to the pk of the PERSON table.

In the code, i create a Person object and a Faculty object and set the
reference on Faculty (inherited from Role) to the newly created
Person.  Depending on how i setup my descriptor for Role, i run into 1
of 2 problems.  1) If i set the auto-update flag on the Person
reference descriptor to 'true', i get an SQL exception complaining
about cannot insert duplicate key on Person because when the Role
object (added to the transaction when i locked Faculty, i assume to
handle persisting the necessary information to the ROLE table) tries
to insert into the Person table in accordance with the auto-update
flag, but of course, so does the actual Person object.  Or, 2) if i
set the auto-update flag to false, committing the Role fails because
of the inability to satisfy the foreign key relationship to Person.

In situation #1, i would expect OJB to recognize that it has already
inserted the Person object and does not need to do so again; and, in
situation #2, i would expect the reorder() method in the
ObjectEnvelopeTable to recognize that the Role needs to be committed
after Person.  I realize that OJB doesn't know anything about my
foreign key constraints on the database, but i couldn't find any way
to explicity define the dependency between the two objects.

Does anyone know of any way around this mess other than dropping the
foreign key constraint?


Saleem.

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



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



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



Reply via email to