Hello,

For one project i have adapted OJB to support multiple table inheritance.
The way i have patched OJB perhaps do not suite your needs but you can read the patchs reports on the following page:
http://dev.factory-part.com/oss/ojb/
I will enjoy any feedback of the potential drawbacks or errors in this patchs. You can refer to the developer mailing list for a little discussion about them (the drawbacks and the patchs).
Best regards,
Ludo
PS: Sorry for my english (or for the english language).


Saleem Shafi a écrit:

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.

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]



Reply via email to