Re: Single Table Inheritance
Re: Single Table Inheritance
- Subject: Re: Single Table Inheritance
- From: Chuck Hill <email@hidden>
- Date: Fri, 07 Oct 2011 10:16:58 -0700
On 2011-10-07, at 10:05 AM, Matteo Centro wrote:
> Thanks Chuck,
>
> actually POI was not abstract nor there was a qualifier... Dumb me!
Good, I thought it was something simple!
> As this WOApp will have to "feed" an iOS app I was planning of using ERRest.
> I also verified that that ERRest, when asked for all POIs of a City, gives me all the relevant attributes, even of Restaurants and Clubs, which is exactly the thing I hoped to get with single table inheritance...WOW!
It is nice.
Chuck
>
> Thanks,
>
> Matteo
>
>
> On Fri, Oct 7, 2011 at 5:36 PM, Chuck Hill <email@hidden> wrote:
> Hi Matteo,
>
> It sounds like something is not right in your model. Check that
> - POI is either abstract or has a qualifier (e.g. qualifier type='P')
> - the Parent entity of Restaurant and Club is set, check that
> - the external (table) name of POI, Restaurant and Club is exactly identical
>
> Chuck
>
> On 2011-10-07, at 7:55 AM, Matteo Centro wrote:
>
> > Hi all,
> >
> > kind of a stupid question but in my whole career with WO I never used Single Table Inheritance so I'm kind of a newbie here...
> >
> > I'll try to explain with a small example: I have an entity called PointOfInterest (POI), defined by the main attributes which are name, latitude, longitude, type and with a relationship to a City.
> > I then created two subclasses of POI
> > Restaurant (with qualifier type='R') and some more attributes
> > Club (with qualifier type='C') and some different attributes
> > All is mapped in two tables, one for City and one for POI. Everything looked fine in my head...
> >
> > I find puzzling though that if I ask a City for its POIs I get an array full of duplicates in this example I'm printing out all the POIs for a City:
> > POI name: Open POI Class: your.app.logic.Club
> > POI name: Jazz Club POI Class: your.app.logic.Club
> > POI name: Dal Baffo POI Class: your.app.logic.Restaurant
> > POI name: Zushi POI Class: your.app.logic.Restaurant
> > POI name: Ristorante POI Class: your.app.logic.Restaurant
> > POI name: Dal Baffo POI Class: your.app.logic.Restaurant
> > POI name: Zushi POI Class: your.app.logic.Restaurant
> > POI name: Open POI Class: your.app.logic.Club
> > POI name: Jazz Club POI Class: your.app.logic.Club
> > POI name: Generic poi POI Class: your.app.logic.PointOfInterest
> > POI name: Ristorante POI Class: your.app.logic.Restaurant
> >
> > In reality I only have 6 items in my POI table: 3 Restaurants, 2 Clubs and one row with blank type. So I was expecting of getting something like this:
> > POI name: Open POI Class: your.app.logic.Club
> > POI name: Jazz Club POI Class: your.app.logic.Club
> > POI name: Dal Baffo POI Class: your.app.logic.Restaurant
> > POI name: Zushi POI Class: your.app.logic.Restaurant
> > POI name: Ristorante POI Class: your.app.logic.Restaurant
> > POI name: Generic poi POI Class: your.app.logic.PointOfInterest
> >
> > Maybe I'm approaching the problem in the stupidest way but I'd like to understand a little bit more about what you guys think...
> >
> > Thanks,
> >
> >
> > Matteo
> >
> > _______________________________________________
> > 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
>
> --
> Chuck Hill Senior Consultant / VP Development
>
> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
> http://www.global-village.net/products/practical_webobjects
>
>
>
>
>
>
>
>
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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