I would recommend you checking out cfcPowerTools (http://www.cfcpowertools.com).  It’s a web based application that generates CFCs.  You can quickly create relationships between CFCs like you describe below.

 

Also, I’m working on adding DAO functionality to cfcPowerTools.  You will be able to generate a complete DAO CFC to handle the CRUD needs for a CFC.  The DAO will reflect all of the properties you have created for your CFC.  Also, additional property meta data will be stored in a XML file instead of as additional attributes in <cfproperty> tag.

 

Thanks

 

Tom Schreck

972-361-9943


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dawson, Michael
Sent: Tuesday, May 10, 2005 10:09 AM
To: [email protected]
Subject: [CFCDev] Do Objects Contain Foreign Key IDs or Values?

 

Let's say I have a simple object called Picture.  This picture can be associated to multiple categories such as: "B&W", "Portrait", "Digital", etc.

 

When modeling the database, I would have a table to store the picture information as well as a related table for the picture categories.  I would assume this to be a "has-a" relation.

 

When I create an object and init it with data, would I pull in only the foreign key ID (1, 2, 3, etc) or do I pull in the value ("B&W", "Portrait", "Digital") and store with the rest of the picture object properties?

 

Or, is there really not a need to do this?

 

I visualize a web-based form that displays picture information.  There are also checkboxes that let me associate one or more categories with each picture.

 

When I build the form, I query pictureDAO to retrieve the picture information.  I would then pass the picture ID to the pictureCategoryGW and get back a list of IDs for the associated categories.  This leads me to believe I really don't need to init the picture object with the category information, at all.  In this case, the controller (form page) will display it as needed.

 

The only issue I see, by not putting the category information in the picture object, would be extra database hits to later get that information.

 

Any suggestions or comments?  Will I ever understand OO?  ;-)

 

Thanks

M!ke

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]

Reply via email to