Re: design help
Re: design help
- Subject: Re: design help
- From: "Arturo Perez" <email@hidden>
- Date: Mon, 30 Aug 2004 11:14:49 -0400
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
Hi Mike,
I wasn't sure how the frequent numbers worked. That is, you might have
an AirlineFrequentTravelerNumber EO and a PersonFrequentTravelerNumber.
It sounds like you have one EO that serves for both? In that case, I
would put a database constraint in and a
validateFrequentTravelerNumber() method. (I'm a belt&suspenders man
when it involves data integrity). The validate would look something like
public void validateFrequentTravelerNumbers() {
if (freqTravNos().count() > 2) throw new ...
// other checks as needed
}
If you have distinct EOs for airlines and people then you could just
have optional toOnes. In that case you may want to do some inheritance.
But I'm not very knowledgeable about EOF-inheritance.
-arturo
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.