You could use a multi-record query to pull the entire team's data out
in one query, and then create the individual person objects, one per
record.  Or you could implement lazy loading of your person objects,
so that they do the DB call themselves on the first data access
operation.  Or, you could ignore the potential bottleneck until it's a
problem, since the increased ease of developing will make buying
another server more feasible.  Or you could use a real ORM solution
(though it probably means a move to java for your business objects) to
do your persistance operations for you, since they're carefully tuned
for max speed (including lazy loading, aggressive caching, etc).

I'd pick the third, myself, and when a bottleneck arises, consider the
fourth option as a solution.

cheers,
barneyb

On 6/9/05, Cedric Villat <[EMAIL PROTECTED]> wrote:
> There was a post last week about limiting db queries when using CFC's that 
> return array's of objects, or something to that affect.
> 
> My question is, how feasible is this? For example, if I have a Team CFC, 
> which has a method of getTeamMembers(). I want this method to return of 
> Person objects. I can then loop through this array and do whatever it is I 
> want to do.
> 
> The problem is if the getTeamMembers() method has to initialize each Person 
> CFC, and the initialize function makes 1 DB call to get that users 
> information, I could potentially be making 10-20 DB calls just to create my 
> TeamMembers array. This invariably gets worse if the Person CFC has another 
> method which runs the init() method of some other CFC.
> 
> Is there a better way to do this? Like only initializing the data when it 
> gets accessed? Or running a specific query which will populate an array of 
> Person CFC's so it is only 1 DB hit? Any ideas?
> 
> Thanks,
> Cedric
> 
> 
-- 
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 50 invites.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:209144
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to