Re: entity inheritance possibilities
Re: entity inheritance possibilities
- Subject: Re: entity inheritance possibilities
- From: Ben Trumbull <email@hidden>
- Date: Mon, 8 Sep 2003 11:02:13 -0700
The PKs must be unique throughout the entire inheritance hierarchy,
regardless of type of inheritance involved.
Assuming your PKs have no intrinsic informational value, as strongly
recommended, you could perform a mapping between PKs (since you have
duplicates, it would probably be a function like entity & PK -> PK),
and copy all the objects to a new set of tables (or alter the PKs
with raw SQL).
The first PK mapping function that comes to mind is (x * maxrows +
PK) where x is the index of the entity in an array of all the
entities, and maxrows is the limit of the number of rows existing in
the entity with the most rows. New rows begin after all these
processed rows just like normal EOF PK generation.
You could apply the same function to the FKs pointing into these
tables. The EOModel has all the information you need to do this
programmatically (i.e. which other tables have FKs to this set of
munged entities, and which columns are the FKs to be fixed up).
While it would be a pain, it is certainly feasible. Actually, I
really don't think this problem is as bad as you describe.
The other approach is not to make this a relationship in EOF
terminology, but instead just make it "business logic". To KVC it
will look just like a relationship. Granted, it won't be a class
property.
Bill thinks you should just export the entire object graph to XML,
alter the schema, and then reimport it (leave the PK generation for
these objects automatic) and save it back to the database.
--
-Ben
_______________________________________________
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.