Rich, I apologize for not making my question totally clear.  What I am
asking is if I you are suggesting injecting the dogFactory into both the
dogDAO as well as the dogDG through CS.

Like this :

<bean id="dogService" class="path.to.service">
       <property name="dogDAO">
               <ref bean="dogDAO"/>
       </property>
       <property name="dogGateway">
               <ref bean="dogGateway"/>
       </property>
</bean>

<bean id="dogDAO" class="path.to.dao">
       <property name="dogFactory">
               <ref bean="dogFactory"/>
       </property>
</bean>

<bean id="dogGateway" class="path.to.gw">
       <property name="dogGateway">
               <ref bean="dogGateway"/>
       </property>
</bean>


On 2/13/07, Richard Kroll <[EMAIL PROTECTED]> wrote:
>
> > Rich, so based on this, it means I should have a dogFactory for my
> > dogGateway as well as my dogDAO, right?
>
> Nope, you would have a single dogFactory to handle creation of dog
> objects.  In its simplest form, the dogFactory would simply return a
> newly created dog instance.  When inside your DAO, you would have CS
> inject the dogFactory.
>
> Here is an example read method for the dogDAO (assuming a getter/setter
> for the dogFactory and that it is injected):
>
> <cffunction name="read" access="public" returntype="path.to.dog">
>        <cfargument name="dogID" required="true" type="numeric" />
>        <cfset var qRead = "" />
>        <cfset var dog = "" />
>
>        <cfquery name="qRead" datasource="#dsn#">
>                SELECT  id, breed, weight
>                FROM    dogTable
>                WHERE   dogID = <cfqueryparam value="#arguments.dogID#"
> cfsqltype="cf_sql_integer" null="false" />
>        </cfquery>
>
>        <!--- ACCESS FACTORY HERE --->
>        <cfset dog = getDogFactory().getDog().init() />
>
>        <cfif qRead.recordcount>
>                <cfset dog.setID(qRead.id) />
>                <cfset dog.setBreed(qRead.breed) />
>                <cfset dog.setWeight(qRead.weight) />
>        </cfif>
>
>        <cfreturn dog />
> </cffunction>
>
> Does that make things clearer?
>
> Rich Kroll
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7 
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs 
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:269641
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to