• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: entity inheritance possibilities
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: entity inheritance possibilities
      • From: "b.bum" <email@hidden>
    • Re: entity inheritance possibilities
      • From: Jonathan Rochkind <email@hidden>
References: 
 >entity inheritance possibilities (From: Jonathan Rochkind <email@hidden>)

  • Prev by Date: WO/HTML trick to check if page loaded completely?
  • Next by Date: Re: entity inheritance possibilities
  • Previous by thread: entity inheritance possibilities
  • Next by thread: Re: entity inheritance possibilities
  • Index(es):
    • Date
    • Thread