Stephan,
 
Unless you need to work with the data in some way, like say with a form that has multiple parts and you design your model so that each part is handled by a different Bean/BO, what you want to use is a "gateway". What's a gateway? How is it different from a DAO?
 
At first, i just threw them together. They seemed to be the same to me, because they interacted with the database. But as i grew a little more experienced, i noticed that sometimes i needed access to multiple rows or to select a specfic group of records - more for the front end, and sometimes i was working with just a single row at a time, more backend stuff. The Bean/BO and the DAO with it's create, read, update and delete methods worked together to modify single rows. But the "FindAll" and "FindWhere" methods sitting there in my original all purpose DAO's were not used in the processes to create and modify the data.
 
Then i worked out that it would be good to cache my all purpose DAO's so they would be available in an instant for those FindAll and FindWhere queries that the front end needed and something in me said "Hey, wait a second ... THAT's why people seperate out those queries and put them in a Gateway. The Gateway occupies a different place and function within the model.
 
So i built myself a GatewayManager of sorts, instantiated it into application scope, and moved those findAll and findWhere queries into Gateways, and the GatewayManager loads those lightweight Gateways and keeps instances of them at the ready for the front end. I've noticed a significant performance gain on the front end, because it tends to used many queries per request.
 
Meanwhile, the DAO's sit waiting for the opportunity to do the CRUD work, and when they are needed, they get instantiated and their Bean/BO partner is passed into them, and they do their part together, and the DAO instance dies. Again, a different place and function within the model, the DAO working together with it's bean pair.
 
*****
 
I'm somehow really getting into Factories these days. I never realized how useful it is to have all your objects instantiated in one place within your application! Funny how i have to learn everything the hard way. :)
 
Nando
 
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Stephen Adams
Sent: Monday, September 12, 2005 12:51 PM
To: [email protected]
Subject: [CFCDev] Multiple query results while using a Bean and DAO

Hi,

I'm trying to use a Bean and a DAO cfc's to access and return data from the database. My question in how do I use a Bean cfc with multiple results.

Do I create a separate page which creates the Bean and DAO objects, then calls the select method of the DAO cfc and then do I create a array of Bean objects, by looping overthe results, each holding the details of query results?

Is there any other ways to do this?

Stephen
----------------------------------------------------------
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]

Reply via email to