Seth, I've being doing a bunch of work for a rewrite of our User Group website and I've kind of done the following for differentiation between a Data Access Object (DAO) and a Gateway:
DAOs: Use to Insert/Update single rows and retrieve a single row based on the passing of the primary id of the object into the function. These functions also return bean objects or accept these objects as arguments. Gateways: used to return multiple rows or recordsets or some other form of data that is not centralized on a singular bean or by the entity's primary id. I would put getAll() and getByCriteria() into the Gateway and getById() in the DAO. I like the idea of the GatewayCriteria method you're thinking of using. Hope this helps, but I'm sure others will chime in as there is a bunch of different ways to do what you are exploring, Phil -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Seth Johnson (KW) Sent: Tuesday, January 10, 2006 12:03 PM To: [email protected] Subject: [CFCDev] Ad-hoc queries using Data Gateway objects I'm trying to set up a data gateway object as part of a new project I'm working on, but I don't really know what its methods should look like. I have a getAll() method that returns all rows from the database and a getById() method that accepts one or more ID values and returns the corresponding rows. This works fine for simple tables, but I also have a large search form where users fill in their criteria for running ad-hoc queries. How should I implement this in the DG object? The approach I'm exploring uses a method called getByCriteria() which accepts a GatewayCriteria object. This object contains all of the ad-hoc criteria definitions including the data member to match (i.e. fieldname), search type (exact match, pattern match, etc) and value(s) look for. The data gateway object loops through the criteria and creates the dynamic SQL for running that query. Is there a better way? Thanks in advance for any suggestions, Seth ---------------------------------------------------------- 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] ---------------------------------------------------------- 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]
