Reactor vs TSQL
The following is a brief example to illustrate both the simplicity of Reactor and how Reactor looks compared to the normal way in which we would perform a CFQUERY.
Here is how you would normally query a SQL table to return distinct user names
SELECT DISTINCT username
FROM users
ORDER BY username asc
</cfquery>
Perform the same query using Reactor
<cfset usersGateway=Reactor.createGateway("users")>
<!--- CREATE A QUERY --->
<cfset q=usersGateway.createQuery() />
<!--- SET THE TABLE FIELDS TO BE RETURNED --->
<cfset q.returnObjectField("users", "username") />
<!--- SET THE ORDER BY (SETASC OR SETDESC) --->
<cfset q.getOrder().setAsc("users", "username") />
<!--- SPECIFY THAT ONLY DISTINCT USER NAMES SHOULD BE RETURNED --->
<cfset q.setDistinct(true) />
<!--- EXECUTE THE QUERY --->
<cfset userquery=usersGateway.getByQuery(q) />
Configuration
You're probably wondering how the magic above was performed, and how some of that was setup before we just magically were able to call it.
Reactor.xml
Contains the configuration information needed for Reactor to know about my datasource and database type
<config>
<project value="wine">
<dsn value="UserDSN">
<type value="mssql">
<mapping value="/UserSample">
<mode value="development">
</mode>
<objects>
</objects>
Create the Reactor Object
CreateObject("Component", "reactor.reactorFactory").init(expandPath("reactor.xml")) />