• 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: pulling data from 2 tables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pulling data from 2 tables


  • Subject: Re: pulling data from 2 tables
  • From: "Jerry W. Walker" <email@hidden>
  • Date: Fri, 17 Feb 2006 08:12:14 -0500

On Feb 17, 2006, at 7:20 AM, Ken Anderson wrote:

You guys are like a married couple! No one would believe you live on opposite sides of the US! :)

Heh, you've heard of Click and Clack, the Tappet Brothers? Just think of us as Revert and Reset, the Stack Brothers.


Personally, I haven't yet gotten over cyber communities that let me chat daily, request and offer help to WO folk from Austria to Australia (They're both near Sydney, aren't they? Oops, Mozart was from Salzburg, so they must be suburbs of Vienna).

On Feb 17, 2006, at 12:00 AM, Jerry W. Walker wrote:

Hi, Jim & Chuck,

On Feb 16, 2006, at 9:11 PM, Chuck Hill wrote:

Hi Jim,

On Feb 16, 2006, at 5:36 PM, Jim Wong wrote:

oh... i have an entity COMPANY which has an attribute customerIndustryID which stores for exception numbers like 7, 10, 11 etc. this numbers can be found in another entity INDUSTRY which has a corresponding attribute like F&B (7), Banking (10), Manufacturing (11) etc.

Now where is that Jerry Walker? He loves questions like this...

He was at choir practice rehearsing Mozart's Requiem. Wonderful music and the right year to do it. :-)


...and you got some nerve, asking that, after traipsing around the world for a month and making the rest of us work as hard as you do answering these questions while you were gone!

OK, I will do a short version and Jerry can do the epic later.

I'm not sure there's any need for an epic here, if I understand Jim's question correctly.


A fundamental rule of thumb with WO (and EOF in particular) is "If you are thinking about keys, you are doing it wrong". Let EOF worry about the numbers. You worry about objects.

What does your model look like? You should have a Company entity related (the a to-one relationship) to an Industry entity based on company.customer_industry_id = industry.industry_id or whatever you called the columns in the database. If not, you should go back and read the tutorials and documention on EOModeler and consider them in the context of what you are trying to do.

Heh, yeah, what Chuck said.

How do I display all the information of a COMPANY in a form and when it display customerIndustryID, i want it to display the name like F&B, Banking, Manufacturing instead of the numbers stored in the COMPANY?

First off, customerIndustryID should not be a class attribute so you should not even have the option of showing it. :-) Exposed keys Bad. Marking the primary and foreign keys as not class properties (click the diamond to the left in EOModeler) can help prevent many problems when you are starting out.

This is where I got a bit confused. If the Industry number is a number assigned by some authoritative outside agency (say, a government taxing agency or some such) and is meaningful to the users of Jim's system as such, then it should probably be a class attribute but it should NOT be used as a primary key for the industry table or as a foreign key for the company table.


On the other hand, if it is simply an arbitrary (unique for each industry) number that Jim made up, or that was assigned by his DBMS, then Chuck is absolutely right, it is a primary key to the INDUSTRY table, can be used as a foreign key in the COMPANY table, it is an artifact of database technology and should not be carried over, or show up at all, in Jim's object graph (that is, it should not be a class property as Chuck mentioned).

So, Jim, if you were including the keys from the database in your object graph, you're resisting the "Way of WO" and you're welcome to request my epic answer. If not, then Chuck's answer (with no admonitions) probably suffices.

Now, if your model is correct, all you need to do is to call customer().industry().name() to get F&B, Banking etc. For use in WO page, add a WOString and bind it to customer.industry.name. Yes, it really is that simple when you are using WO!

Absolutely! I couldn't have said it better myself... I could have said it in way more words, but not better. :-)


Regards,
Jerry

--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial Strength Internet Enabled Systems


    email@hidden
    203 278-4085        office


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40anderhome.com


This email sent to email@hidden



--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial Strength Internet Enabled Systems


    email@hidden
    203 278-4085        office



_______________________________________________
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


  • Follow-Ups:
    • Re: pulling data from 2 tables
      • From: David Avendasora <email@hidden>
References: 
 >pulling data from 2 tables (From: Jim Wong <email@hidden>)
 >Re: pulling data from 2 tables (From: Chuck Hill <email@hidden>)
 >Re: pulling data from 2 tables (From: "Jerry W. Walker" <email@hidden>)
 >Re: pulling data from 2 tables (From: Ken Anderson <email@hidden>)

  • Prev by Date: Re: Custom Class Problems
  • Next by Date: Re: wowebservice sessions
  • Previous by thread: Re: pulling data from 2 tables
  • Next by thread: Re: pulling data from 2 tables
  • Index(es):
    • Date
    • Thread