I was on a project many moons ago where the architect called for a DAO per table, all interaction with that table had to go through its corresponding DAO. We could do no joins because we could not join DAO's. The design made simple processes extremely complex and, in my opinion, contributed to the failure of the project.
Personally, I don't think I would limit my DAOs to single instances only. I would probably have a method to return a single instance and a method to return a result set.
Just my $0.02.
Doug James IT Developer MUSC - Hollings Cancer Center http://hcc.musc.edu
Raymond Camden wrote:
----------------------------------------------------------Also, DAOs usually provide data access for a single instance of an object, with the read method returning a transfer object instead of a multi-row query / array of transfer objects. If you need to select multiple rows (like your select() method), that'd traditionally fall into a "Data Gateway" object. A gateway would typically have methods that selected all records or records based on a given condition. (I think there's some debate over what a gateway should return though - I've seen both recordsets and arrays of transfer objects).
I was wondering if you, or anyone, could comment more about this concept. One of the problems I have with it is that I like the fact the DAO contains all the SQL, but now we have 2 CFCs with SQL in them. Wouldn't it be nice if all the SQL code for a particular bean was contained within one file? Why should the DAO only work with one record?
-ray
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at [EMAIL PROTECTED]
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at [EMAIL PROTECTED]
