The DAO creates the BO or TO; it isn't passed in.
Christopher Bradford
----- Original Message ----- From: "Peter J. Farrell" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, April 07, 2005 11:13 PM
Subject: Re: SPAM-LOW: Re: [CFCDev] DAO Pattern quickie
Christopher Bradford wrote:
Sorry, I wasn't clear. In my last example, the DAO.read(id) *does* create a BO (or TO or whatever you choose) and returns it to the Manager.
And this fits with my preference of C to answer your original question.
Caller calls BOManager.getBO(id) BOManager checks its pool and has a couple of options:
- Return the existing BO from the pool
- Call DAO.read(id)
- If the DAO returns a BO, the Manager can replace an existing BO in its pool with the one returned from the DAO and return it
- If the DAO returns a TO, the Manager can reset and populate an existing BO from the pool with the data in the TO, or it can instantiate a new BO and populate from the TO, then replace an existing BO from the pool and return it
In none of these cases does the BO to be populated need to be passed to the DAO, and the DAO doesn't have to know anything but the database and the BO (or TO) it's populating
Christopher Bradford
Are you passing in an empty bean (BO) or TO to the DAO? Or are you having the DAO create the bean or TO from inside of the DAO?
---------------------------------------------------------- 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).
An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
