• 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: design help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: design help


  • Subject: Re: design help
  • From: Michael Engelhart <email@hidden>
  • Date: Mon, 30 Aug 2004 10:19:58 -0500

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

Yes, I have one EO that serves, airlines, hotels, cars and any other type that may come down the road. There is a to-one in the FrequentTraveler table to a FrequentTravelerType which is just a lookup table for whether it's a Car, Hotel, Airline or whatever else comes down the road (Cruise, etc).


I think that validation method and/or constraint solves my problem. Thanks for the help!

Mike
On Aug 30, 2004, at 10:14 AM, Arturo Perez wrote:

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.


References: 
 >design help (From: Michael Engelhart <email@hidden>)
 >Re: design help (From: "Arturo Perez" <email@hidden>)
 >Re: design help (From: Michael Engelhart <email@hidden>)
 >Re: design help (From: "Arturo Perez" <email@hidden>)

  • Prev by Date: Re: design help
  • Next by Date: Re: design help
  • Previous by thread: Re: design help
  • Next by thread: Re: design help
  • Index(es):
    • Date
    • Thread