Single Table Inheritance
Single Table Inheritance
- Subject: Single Table Inheritance
- From: Matteo Centro <email@hidden>
- Date: Fri, 07 Oct 2011 16:55:46 +0200
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