• 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: Defining child Entities.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Defining child Entities.


  • Subject: Re: Defining child Entities.
  • From: David Avendasora <email@hidden>
  • Date: Tue, 11 Aug 2009 11:08:27 -0400


On Aug 11, 2009, at 6:42 AM, Gustavo Pizano wrote:

sorry keepin gin the lsit.

On Tue, Aug 11, 2009 at 12:41 PM, Gustavo Pizano <email@hidden> wrote:
Ahmm so I can relate Area to itslef?
 interesting.. well I guess in the java class will be something like \

public Area ....
private NSArray <Area> areas...

or something like that.

Yes. 

Call the Area.parentAreaId -> Area.areaId relationship "parentArea"
Call the Area.areaId -> Area.parentAreaId relationship "childAreas"

you'll have the following methods in your Area.java class:

public Area parentArea()...
public NSArray<Area> childAreas()...
(plus all the various setters and fetch stuff generated by the templates)


another thing, but in the db I will need 2 tables isn't it? one area and anotherone SubAreas, I hadn't made such a inheritance in a relational world.

Do you really need inheritance? Do "sub" Areas _really_ have differences from an Area? If so, do those differences _really_ require you to treat them as different classes?

Inheritance should by your absolute last choice. It is needed in some situations, but you really should try to avoid using it unless it is truly required. I've often used inheritance too quickly and ended up painting myself into a corner later in the development process and wishing I had used a different design pattern to meet my needs instead of inheritance.

If you really do need inheritance, then you need to pick from the 3 different strategies for creating the inheritance structure in the DB. Single-Table Inheritance (most likely the best choice, one table that holds data for the super and all subclasses), Vertical Inheritance (one table for the super, one table for each sublcass. Be forwarned, it's not often used so there is not a lot of support out there. Hi Lachlan) or Horizontal Inheritance (one table for each subclass).

HTH,

Dave




G.

On Tue, Aug 11, 2009 at 12:38 PM, Stefan Klein <email@hidden> wrote:
Hi Gustavo,

you need only one entity.

Area:
    area_pk
    parent_area_fk
    foo

Now you build a relationship area_pk <->> parent_area_fk.
So each area can have many 'subareas' while one are has only one parent area.

Stefan


Gustavo Pizano schrieb:
Hello Im doing an eomodel.. .and I have an entity called Area, and SubArea, for me an area can have many subareas, but subarea its an area itself also..
so its like Area <- >>SubArea.

Now what are the implications of defyning Area with its properties, and then SubArea and put as parent Area?... I see that inside Area Entity there is SubArea Entity also... but I guess this doesn't guaranties me the to-many relationship between the 2 entities isn't it?do  I still have t defying the relationship?


Thanks

 Gustavo


_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: 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

References: 
 >Defining child Entities. (From: Gustavo Pizano <email@hidden>)
 >Re: Defining child Entities. (From: Stefan Klein <email@hidden>)
 >Re: Defining child Entities. (From: Gustavo Pizano <email@hidden>)

  • Prev by Date: Re: Session... when are they created?
  • Next by Date: Re: Defining child Entities.
  • Previous by thread: Re: Defining child Entities.
  • Next by thread: Re: Defining child Entities.
  • Index(es):
    • Date
    • Thread