Adam,

this would be my suggestion however some CS guru might have a better idea

<bean id="DogDAO" class="com.DogDAO" />

<bean id="DogGateway" class="com.DogGateway" />

<bean id="DogService" class="com.DogService">
   <property name="DogDAO">
     <ref bean="DogDAO" />
   </property>
   <property name="DogGateway">
     <ref bean="DogGateway" />
   </property>
</bean>

Thanks

Qasim

On 2/12/07, Adam Roussos <[EMAIL PROTECTED]> wrote:
>
> All,
>
> I am still trying wrap my head around using ColdSpring+ModelGlue and
> focusing on getting my best practices right.  That said, there is one major
> question that I am struggling with.
>
> As for some background, I have modeled my CS+MG development around Brian
> Kotek's excellent article on ColdSpring.  In this article Brian, reinforces
> using a Service with a Data Gateway and a DAO that depend on it.  In
> addition, the DAO and DG have a config that they depend on.  For this
> example, let's say I am building an application to manage an inventory of
> dogs.  If we follow out Brian's article, this means that I have a
> DogService.cfc which depends on the DogDAO.cfc as well as a DogGateway.cfc.  
> This
> is where I get stuck.  I want my DG and my DAO to return objects of type
> "Dog" of course.  So, how do I handle the instantiation of these objects
> from within the DAO and the DG.  The obvious answer is "use cfobject dummy"
> but this means neglecting this nice shiny IoC framework we have.  So, if we
> don’t hardcode the "path" to the CFC, how do we do it?
>
> I have thought about a couple solutions with the following being my "best
> bet".  This would be to add a DogFactory.cfc and make it a dependency of
> DogService.cfc and define this relationship in ColdSpring.  Then, within
> the service (DogService), we can pass the DogFactory to the DogDAO and
> DogGateway for them to use.  Although this solution does eliminate the hard
> coded object creation, I believe this to be a very unelegant solution.  It
> seems unnecessary to create two factories, one for the DAO and one for the
> DG.
>
> So - how do I create an object (or multiple) from within my DAO and DG
> without hard coding the path?
>
> AdamR
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:269561
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