a DAO is related to an object, not to tables in a DB, eh? Many times one objects properties may span more than one table. Condider a User object with properties: name, type, id, manager, department, awards where awards is a list of awards. This is one object. But the employee type maybe in a seperate table from the table storing name, typeid, id, and mamnager. Certainly teh awards will be in a seperate table too, eh? So, UserDAO.read() would perform some SQL that joins the tables, returns the query result, and creates the User object, then returns it.
my $.00002 DK On 9/15/05, Nick Han <[EMAIL PROTECTED]> wrote: > Barney, can you reduce the language down like a fraction so I can > understand better on what you just said? Ok, for a DAO example, I have > a form that will insert information about the user into users table, > contacts table, and employment table? Will I have one DAO to do all > this or 3 separate DAOs, one for each table? It sounds like what you > said is that there should only be one DAO? Thanks in advance. > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On > Behalf Of Barney Boisvert > Sent: Thursday, September 15, 2005 11:41 AM > To: [email protected] > Subject: Re: [CFCDev] Table joins DAOs > > Don't think of entities in relation to your DB tables. The two often > line up, but that's coincidence. Think about your entities. Each > entity type should have an object that deals with persisting objects > of that type. If that means one table, then it's one table. If it > means five tables (which might be indicitive of a modelling problem), > then your DAO will hit five tables. > > Simply put, DAOs persist single entities, whatever it takes. > > cheers, > barneyb > > On 9/15/05, Joe Ferraro <[EMAIL PROTECTED]> wrote: > > > > > > > > When creating a dao / gateway / whatever you may call it (your object > that > > accesses the database) and you need perform a table join should you > create a > > separate object which job is to query against the joined tables as the > > representation of one entity? > > -- > Barney Boisvert > [EMAIL PROTECTED] > 360.319.6145 > http://www.barneyb.com/ > > Got Gmail? I have 100 invites. > > > ---------------------------------------------------------- > 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] > > > > > ---------------------------------------------------------- > 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] > > > -- Douglas Knudsen http://www.cubicleman.com this is my signature, like it? ---------------------------------------------------------- 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]
