Re: design help
Re: design help
- Subject: Re: design help
- From: Chuck Hill <email@hidden>
- Date: Mon, 30 Aug 2004 09:14:43 -0700
I don't see why it would be illegitimate. It is, properly, one car
account and one airline account. Two to-ones feels like the most
correct answer. Personally, I've used this "pattern" frequently in
similar situations. The other thing you might want to consider is
using single table inheritance to model the frequent user accounts.
Then the person could have a to-many to airline accounts, hotel
accounts, car rental etc. They would all live in the same DB table and
all share common logic, but would be unique object types in your
application. I've also used this to good effect.
Pleased that you like the book!
Chuck
On Aug 30, 2004, at 8:35 AM, Michael Engelhart wrote:
that's what I was originally thinking but in my experience (albeit
very limited experience) with modeling I hadn't come across multiple
to-one's to the same table. Is that a legitimate way to handle this
situation (i.e., if I bring in a consultant in 12 months to help
refactor they won't laugh me out of the conference room ;-)). This
also has the needed side benefit of me knowing that frequentRenterId
is the car rental agency frequent renter number and not the frequent
flyer number for the airlines which is important and I won't have to
write code to check the "type" attribute in the FF table.
BTW, nice book - just started reading it last night.
Thanks
Mike
On Aug 30, 2004, at 10:25 AM, Chuck Hill wrote:
Or use two to-one relationships to FrequentTraveler.
Chuck
On Aug 30, 2004, at 8:06 AM, Michael Engelhart wrote:
Thanks Arturo -
I guess my confusion stems from the fact that I need to mandate that
there be ONLY two frequent traveler numbers for a particular car
reservation. I was thinking maybe there was some sort of
constraint I could put on the column with EOModeler. but I guess the
best way would just be to have that in my EO code then?
Thanks
MIke
On Aug 30, 2004, at 10:00 AM, Arturo Perez wrote:
Michael Engelhart wrote:
I have a travel FrequentTraveler table that stores frequent
traveler numbers (airline frequent flyer numbers, car rental
agency requent renter numbers, hotel frequent guest numbers, etc).
I have a CarReservation table that stores data associated with a
car reservation. Two of the allowable pieces of information are
a single airline frequent flyer number and a single car rental
agency frequent renter number. ... My
original design idea would be to keep all a customers frequent
traveler numbers (some customers can have as many as 20 or 30 if
they are business travelers) in the FrequentTraveler table in a
one-to-many relationship. I'm not sure how to model this
relationship back to FrequentTraveler so that I just store
FrequentTravelId's in my CarReservation table.
Hi Mike,
Not sure I follow the problem.
You have FrequentTraveler->>FreqTravNo
CarReservation->>FreqTravNo (it's a toMany because you allow two)
or
CarReservation->FreqTravNo (if you keep airline and people numbers
separate).
To get to a FrequentTraveler from a CarReservation.
carReservation.valueForKeyPath("freqTravNo.frequentTraveler");
To set a FrequentTravelerNumber on a reservation
carReservation.addObjectToBothSidesOfRelationshipWithKey(
selectedFreqTravNo, "freqTravNo");
Is all that right?
-arturo
_______________________________________________
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.
_______________________________________________
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.
_______________________________________________
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.