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

**Idea**
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.cfm]
<cfquery name=”mydata” resultType=”cfcs.Product”>
SELECT productID, name
FROM products
</cfquery>

<cfoutput>
#mydata.getProductName()[1]#
</cfoutput>

[cfcs/Product.cfc]
<cfcomponent>
<cfscript>
variables.productID = 0;
variables.name = “”;
</cfscript>

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

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

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

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

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

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

**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?