• 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: Setting up horizontal inheritance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting up horizontal inheritance


  • Subject: Re: Setting up horizontal inheritance
  • From: Lachlan Deck <email@hidden>
  • Date: Sat, 1 Nov 2008 15:59:19 +1100

On 01/11/2008, at 3:39 PM, Paul Hoadley wrote:

After finding "Subclass Entity" in Entity Modeler, and re-making the child entity specifying horizontal inheritance, this question remains:

On 01/11/2008, at 11:19 AM, Paul Hoadley wrote:

2. Practical WebObjects (p. 32) states that horizontal inheritance "puts a complete copy of each entity into a separate table". Does EOF do this for me? That is, if I use _AMPerson.createAMPerson(), does EOF put a row in the 'amperson' table, and a corresponding row in the 'person' table?

I've just used _AMPerson.createAMPerson() to create a new AMPerson. There's a new row in 'amperson', and nothing in 'person'. Have I misunderstood "complete copy" here? That is, should there be a corresponding new row in 'person', or not?

Which documentation were you reading? Horizontal inheritance is what you said you want ... but that's not matching your expectations. Brief summary of inheritance types is as follows:


-- Vertical Inheritance --
Parent entity maps to its own table in the database.
Marking it abstract indicates that you don't intend on instantiating the parent entity on its own.
Child entities map to a separate table in the database joining on the primary key via a non-class relationship.
Child entities inherit the attributes from parent. However they are given a derived definition which looks like parentRelationship.attributeName.


-- Horizontal Inheritance --
Parent DOES NOT map to a table in the database.
It is therefore abstract by nature. You cannot instantiate the parent entity obviously.
Child entities map to a separate table in the database.
Child entities inherit the parent attributes (they actually have a copy of the attributes from parent). In this sense it's like an interface.


-- Single Table Inheritance --
Parent entity maps to the same table as its children.
Marking it abstract indicates that you don't intend on instantiating the parent entity on its own.
Child entities share the primary key of the parent.
Child entities inherit the attributes from parent.
All child entity attributes must allow null.


For both VI and STI you usually define a column in the parent (e.g., called entityType) that's populated on awakeFromInsertion with e.g., if (entityType() == null) setEntityType(entityName());
In the model you then in each child entity set the definition for the restricting qualifier to e.g., (entityType like 'EntityName').


See the docs here for proper descriptions of each type.
<http://developer.apple.com/documentation/WebObjects/UsingEOModeler/7ModelingInheritance/chapter_7_section_1.html#//apple_ref/doc/uid/TP30001018-CH207-TP1 >


with regards,
--

Lachlan Deck

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Setting up horizontal inheritance
      • From: Paul Hoadley <email@hidden>
References: 
 >Setting up horizontal inheritance (From: Paul Hoadley <email@hidden>)
 >Re: Setting up horizontal inheritance (From: Paul Hoadley <email@hidden>)

  • Prev by Date: Re: Setting up horizontal inheritance
  • Next by Date: Re: Setting up horizontal inheritance
  • Previous by thread: Re: Setting up horizontal inheritance
  • Next by thread: Re: Setting up horizontal inheritance
  • Index(es):
    • Date
    • Thread