This is one I really want to see happen as it is HIGHLY useful, at least to me.

When querying a database I want to return a query but a query of a cfc instances (a value object [or bean…pending your terminology]). I don’t want to return an Array of Structs though.

**Code Proposal**
On _cfquery_, add a _resultType_ attribute. This attribute would take a path to a CFC. The _resultType_ CFC should be nothing more than a value object (bean) based on the spec required by Adobe.

**Code Example **
<cfquery name=”mydata” resultType=”cfcs.Product”>
SELECT productID, name
FROM products


variables.productID = 0; = “”;

<cffunction name=”init” access=”public” returntype=”string”>
<cfreturn this />

<cffunction name=”getProductID” access=”public” returntype=”numeric”>
<cfreturn variables.productID />

<cffunction name=”setProductID” access=”public” returntype=”void”>
<cfargument name=”productID” type=”numeric” required=”yes” />
<cfset variables.productID = arguments.productID />

<cffunction name=”getName” access=”public” returntype=”string”>
<cfreturn />

<cffunction name=”setName” access=”public” returntype=”void”>
<cfargument name=”name” type=”numeric” required=”yes” />
<cfset = />

<cffunction name=”getDisplayName” access=”public” returntype=”string”>
<cfreturn & ” (” & variables.productID & “)” />

**Time Saving Tip**
This could be annoying to some (having to write extra code) but a query would still be a query if you didn’t specify the _resultType_. You also could use _onMissingMethod_ to get/set your variables instead of writing every single one of the getters/setters. Another option is to use or write a code generator.

Let’s go Adobe…what’cha think?