lazy=proxy gives you N+1 behaviour for your collection.  That is, if
you need a Category and it's 10 subcategories, you'll end up doing 11
queries (one to retrieve each row individually).  Of course, if you
only use the category and three children you'll only run 4 queries.
But if you do an eager fetch of the subcategories (the default),
you'll run a single query.  Period.  Yes, it'll be wider, but it's a
single query and therefore avoids a significant amount of overhead.

I've done a number of projects with Hibernate, and if I've learned
anything, it's that second guessing Hibernate is usually the wrong
thing to do.  I don't know where those guys learned how to do their
jobs, but they are DAMN good at it.

cheers,
barneyb

On Sun, Jan 17, 2010 at 7:23 PM, Raymond Camden <rcam...@gmail.com> wrote:
>
> According to this posty,
> http://www.rupeshk.org/blog/index.php/2009/09/coldfusion-orm-performance-tuning-lazy-loading/,
> if you use lazy=proxy, you would only load the objects you use. So if
> you only displayed the first three, then only the first three would be
> loaded.
>
> On Sun, Jan 17, 2010 at 7:13 PM, Barney Boisvert <bboisv...@gmail.com> wrote:
>>
>> If you subCategories collections are relatively small, then you should
>> be safe to just loop over it and terminate after the third row.  Yeah,
>> you'll be getting more than you need back from the database, but
>> Hibernate is really good about optimizing data access for
>> relationships, so I'd assume it WON'T be a problem until you
>> demonstrate via load testing that it is.
>>
>> No question, ORM is quite a departure from the normal SQL world.  It
>> can be hard to get into, but it's worth giving it a try.  Really.  The
>> payoffs in the maintenance phase are huge, because you're expression
>> your code at a much higher level than with SQL.
>>
>> cheers,
>> barneyb
>>
>> On Sun, Jan 17, 2010 at 10:44 AM, Victor Moore <victor.mo...@gmail.com> 
>> wrote:
>>>
>>> Hi Barney,
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:329745
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to