Vertical Inheritance - Deleting Superclasses before Subclasses?
Vertical Inheritance - Deleting Superclasses before Subclasses?
- Subject: Vertical Inheritance - Deleting Superclasses before Subclasses?
- From: "MacMullin, Jake (DCS)" <email@hidden>
- Date: Tue, 11 Mar 2003 15:58:09 +1030
Is there a good reason why WebObjects deletes superclasses before subclasses
when using vertical inheritance? I've created an EOModel using vertical
inheritance as per Apple's article "Modelling Inheritance".
My model looks a bit like this:
-PERSON-
ID (PK)
SURNAME
FIRST_NAME
||
\/
-EMPLOYEE-
ID (PK, FK references PERSON.PK)
POSITION
Everything works well except EOModeler doesn't generate Foreign Key
constraints for the tables involved in the relationships used to achieve
inheritance. Obviously, it is in the interests of database integrity to have
these constraints (It doesn't make sense to have an Employee with a primary
key that is not also a primary key of the superclass, Person). To remedy
this, I have added the constraints myself.
ALTER TABLE EMPLOYEE ADD CONSTRAINT EMPLOYEE_person_FK FOREIGN KEY (ID)
REFERENCES PERSON (ID);
However, when I create a Dir2Web application to test my model I get an error
when I try and delete a subclass. It seems that WebObjects is attempting to
delete the superclass (Person) before the subclass (Employee). I have
noticed this by looking at the SQL that WebObjects generates (by using the
-EOAdaptorDebugEnabled YES launch argument).
The database won't allow this because it violates the foreign key constraint
on the Employee table (I'd be left with an Employee that has a PK that
doesn't also appear in the Person table). I have the same behaviour occuring
in both SQL Server 2000 and Openbase.
Is there a way to get WO to delete the children before the parents? Has
anyone else had this problem?
Regards,
Jake MacMullin
This e-mail is personal. It is not authorised by, nor sent on behalf of, the
Government of South Australia.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.