Note that something like Transfer can manage this for you. You can specify
lazy loading of relationships if you wish.
On Thu, Oct 23, 2008 at 7:15 AM, Ronan Lucio <[EMAIL PROTECTED]> wrote:
> Alan,
>
> Yes, it's the point.
>
> One option for reading the object is using lazy load.
> In my case I use a signal to know if it's loaded or not.
>
> Example:
>
> function getProduct()
> if ( not isObject(variables.instance.product) ) {
> variables.instance.product =
> application.factory.getService("product").get( getProductID() );
> }
> return variables.instance.product
> }
>
> I know it isn't a pattern specific. I'd like to use Ghost Lazy Load, but
> the above solution seems to fit better for Coldfusion's limitations for
> create instances.
>
> I work for a national portal, so performance is always a issue to be
> considered.
>
> Ronan
>
> Alan Livie escreveu:
>
> I think for saving an object this approach is fine.
>
> ie your controller may pass the FORM scope to your method that creates the
> bean before persisting it and its likely you would just have the id's of the
> dependencies (foreign keys) from the form data. I see no point in building a
> complex object when all you need o persist is the id's of the related
> objects.
>
> When displaying things you may need the full composed objects depending on
> how much of the related data you need to display.
>
> If you need to display an Order and all the OrderItems for the Order I
> would look at using an Iterator / IBO bean for the OrderItems which would be
> wired into the Order. It will save you a performance hit with object
> creation and you get the benefits of encapsulation in the same way as
> building an array of OrderItem objects.
> I always end up on this list bigging up Peter and Paul's IBO / Iterator but
> I love the pattern :-)
>
> Alan
>
>
>
> ----- Original Message ----
> From: Ronan Lucio <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
> To: [email protected]
> Sent: Wednesday, October 22, 2008 8:43:41 PM
> Subject: [CFCDEV] Dependent Object
>
>
> Hi,
>
> I have a medium complex application.
> Some objects have several dependencies (foreign keys).
>
> In a fancy OO application I should get several populated beans and set
> in the main object.
> The problem I see is in some cases I just want to save the main object,
> and in such cases I just need the foreign keys from the dependent objects.
>
> I worry if it could lead to some performance problems in a high accessed
> site or if it's worth to just setForeignKey() in that cases.
>
> What do you think about that?
> Is there any situation where you have a setClient( client ) and a
> setClientID( clientID )?
> So I can just setClientID() and my clientService.save() use the
> client.getClientID().
> This would avoid loading some many unneeded objects.
>
> The problem I refer is when I have an object (i.e. order) with some many
> dependencies (client, product, category and so on.)
> There are some dependent objects having a huge bunch of set()s.
>
> Thank you,
> Ronan
>
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CFCDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cfcdev?hl=en
-~----------~----~----~----~------~----~------~--~---